summaryrefslogtreecommitdiff
path: root/data
diff options
context:
space:
mode:
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2008-03-24 22:58:00 +0100
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2008-03-24 22:58:00 +0100
commitab5703bcdf888e0ea9d65ba194eaeea922f72146 (patch)
tree65413c5355dfc5295fcf650c4ba75e2246fc2bf7 /data
parent78ccfb89403dc2fd2c06d4bbaca2129e2ba4c968 (diff)
utils: Utils.secs_to_short convert seconds into hour:minute:seconds format etc
Diffstat (limited to 'data')
-rw-r--r--data/rbot/plugins/youtube.rb20
1 files changed, 2 insertions, 18 deletions
diff --git a/data/rbot/plugins/youtube.rb b/data/rbot/plugins/youtube.rb
index 947156bc..5f1aa822 100644
--- a/data/rbot/plugins/youtube.rb
+++ b/data/rbot/plugins/youtube.rb
@@ -71,15 +71,7 @@ class YouTubePlugin < Plugin
vid[:desc].gsub!(/\s+/m, " ")
end
if secs = vid[:seconds]
- mins, secs = secs.divmod 60
- hours, mins = mins.divmod 60
- if hours > 0
- vid[:duration] = "%s:%s:%s" % [hours, mins, secs]
- elsif mins > 0
- vid[:duration] = "%s'%s\"" % [mins, secs]
- else
- vid[:duration] = "%ss" % [secs]
- end
+ vid[:duration] = Utils.secs_to_short(secs)
else
vid[:duration] = _("unknown duration")
end
@@ -109,15 +101,7 @@ class YouTubePlugin < Plugin
:format => fmt
}.delete_if { |k, v| v.nil? }
if seconds
- mins, secs = seconds.divmod 60
- hours, mins = mins.divmod 60
- if hours > 0
- vid[:formats].last[:duration] = "%s:%s:%s" % [hours, mins, secs]
- elsif mins > 0
- vid[:formats].last[:duration] = "%s'%s\"" % [mins, secs]
- else
- vid[:formats].last[:duration] = "%ss" % [secs]
- end
+ vid[:formats].last[:duration] = Utils.secs_to_short(seconds)
else
vid[:formats].last[:duration] = _("unknown duration")
end