fixes #2494: Twitter bookmarklet: support uploading video
This commit is contained in:
@@ -77,7 +77,7 @@ $preview_flagged_color: #F00;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
@mixin audio-icon {
|
||||
@mixin sound-icon {
|
||||
content: "♪";
|
||||
position: absolute;
|
||||
width: 20px;
|
||||
|
||||
@@ -108,12 +108,12 @@ div#c-comments {
|
||||
}
|
||||
}
|
||||
|
||||
&[data-has-audio=true] {
|
||||
&[data-has-sound=true] {
|
||||
div.preview {
|
||||
position: relative;
|
||||
|
||||
&:before {
|
||||
@include audio-icon;
|
||||
@include sound-icon;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,9 +35,9 @@ div#c-moderator-post-queues {
|
||||
}
|
||||
}
|
||||
|
||||
&[data-has-audio=true] {
|
||||
&[data-has-sound=true] {
|
||||
aside:before {
|
||||
@include audio-icon;
|
||||
@include sound-icon;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,8 +30,8 @@ article.post-preview {
|
||||
@include animated-icon;
|
||||
}
|
||||
|
||||
&[data-has-audio=true]:before {
|
||||
@include audio-icon;
|
||||
&[data-has-sound=true]:before {
|
||||
@include sound-icon;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ module Sources::Strategies
|
||||
attrs = TwitterService.new.client.status(status_id).attrs
|
||||
@artist_name = attrs[:user][:name]
|
||||
@profile_url = "https://twitter.com/" + attrs[:user][:screen_name]
|
||||
@image_url = attrs[:entities][:media][0][:media_url] + ":orig"
|
||||
@image_url = image_urls.first
|
||||
@artist_commentary_title = ""
|
||||
@artist_commentary_desc = attrs[:text]
|
||||
end
|
||||
|
||||
@@ -24,7 +24,13 @@ class TwitterService
|
||||
urls << obj[:media_url] + ":orig"
|
||||
end
|
||||
attrs[:extended_entities][:media].each do |obj|
|
||||
urls << obj[:media_url] + ":orig"
|
||||
if obj[:video_info]
|
||||
largest = obj[:video_info][:variants].select {|x| x[:url] =~ /\.mp4$/}.max_by {|x| x[:bitrate]}
|
||||
urls.clear
|
||||
urls << largest[:url] if largest
|
||||
else
|
||||
urls << obj[:media_url] + ":orig"
|
||||
end
|
||||
end
|
||||
urls.uniq
|
||||
rescue
|
||||
|
||||
@@ -87,7 +87,7 @@ class Upload < ActiveRecord::Base
|
||||
|
||||
def tag_audio
|
||||
if is_video? && video.audio_channels.present?
|
||||
self.tag_string = "#{tag_string} audio"
|
||||
self.tag_string = "#{tag_string} video_with_sound"
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@ class PostPresenter < Presenter
|
||||
def self.data_attributes(post)
|
||||
%{
|
||||
data-id="#{post.id}"
|
||||
data-has-audio="#{post.has_tag?('audio')}"
|
||||
data-has-sound="#{post.has_tag?('video_with_sound|flash_with_sound')}"
|
||||
data-tags="#{h(post.tag_string)}"
|
||||
data-pools="#{post.pool_string}"
|
||||
data-uploader="#{h(post.uploader_name)}"
|
||||
|
||||
Reference in New Issue
Block a user