mirror of
https://github.com/KevinMidboe/spotify-downloader.git
synced 2025-10-29 18:00:15 +00:00
Some code refactoring
This commit is contained in:
@@ -1,4 +1,6 @@
|
|||||||
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from core import const
|
from core import const
|
||||||
|
|
||||||
log = const.log
|
log = const.log
|
||||||
@@ -10,8 +12,6 @@ except ImportError:
|
|||||||
log.info('Please remove any other slugify library and install `unicode-slugify`')
|
log.info('Please remove any other slugify library and install `unicode-slugify`')
|
||||||
sys.exit(5)
|
sys.exit(5)
|
||||||
|
|
||||||
import os
|
|
||||||
|
|
||||||
formats = { 0 : 'track_name',
|
formats = { 0 : 'track_name',
|
||||||
1 : 'artist',
|
1 : 'artist',
|
||||||
2 : 'album',
|
2 : 'album',
|
||||||
@@ -107,13 +107,10 @@ def filter_path(path):
|
|||||||
os.remove(os.path.join(path, temp))
|
os.remove(os.path.join(path, temp))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def videotime_from_seconds(time):
|
def videotime_from_seconds(time):
|
||||||
if time < 60:
|
if time < 60:
|
||||||
return str(time)
|
return str(time)
|
||||||
if time < 3600:
|
if time < 3600:
|
||||||
return '{0}:{1:02}'.format(time//60, time % 60)
|
return '{0}:{1:02}'.format(time//60, time % 60)
|
||||||
|
|
||||||
return '{0}:{1:02}:{2:02}'.format((time//60)//60,
|
return '{0}:{1:02}:{2:02}'.format((time//60)//60, (time//60) % 60, time % 60)
|
||||||
(time//60) % 60,
|
|
||||||
time % 60)
|
|
||||||
|
|||||||
Reference in New Issue
Block a user