|
@@ -39,7 +39,6 @@ from lib_stov import subscription
|
|
|
from lib_stov import configuration
|
|
|
from lib_stov import stov_exceptions
|
|
|
from lib_stov import database
|
|
|
-from lib_stov import noapi
|
|
|
|
|
|
|
|
|
"""Setup the logger to log messages to stdout and stderr"""
|
|
@@ -448,17 +447,16 @@ if options.add is True:
|
|
|
+ _(" successfully added"))
|
|
|
|
|
|
elif options.list is True:
|
|
|
- Listofsubscriptions = db.GetSubscriptions()
|
|
|
+ Listofsubscriptions = db.GetSubscriptions(conf)
|
|
|
sub_state = None
|
|
|
if len(Listofsubscriptions) != 0:
|
|
|
logger.info(_("ID Title"))
|
|
|
for sub in Listofsubscriptions:
|
|
|
- if int(sub[6]) == 0:
|
|
|
+ if not sub.disabled:
|
|
|
sub_state = _("enabled")
|
|
|
- elif int(sub[6]) == 1:
|
|
|
+ elif sub.disabled:
|
|
|
sub_state = _("disabled")
|
|
|
- if sub[0] is not None:
|
|
|
- logger.info(str(sub[0]) + " " + sub[1]
|
|
|
+ logger.info(str(sub.GetId()) + " " + sub.GetTitle()
|
|
|
+ " (%s)" % sub_state)
|
|
|
else:
|
|
|
logger.info(_("No subscriptions added yet, add one!"))
|
|
@@ -481,17 +479,7 @@ elif options.deleteid is not None:
|
|
|
else:
|
|
|
logger.info(_("Subscription deleted successfully!"))
|
|
|
elif options.update is True:
|
|
|
- listofsubscriptions = []
|
|
|
- subscriptions = db.GetSubscriptions()
|
|
|
- for element in subscriptions:
|
|
|
- listofsubscriptions.append(subscription.sub(id=element[0],
|
|
|
- title=element[1],
|
|
|
- type=element[2],
|
|
|
- name=element[3],
|
|
|
- search=element[4],
|
|
|
- directory=element[5],
|
|
|
- disabled=element[6],
|
|
|
- conf=conf))
|
|
|
+ listofsubscriptions = db.GetSubscriptions(conf)
|
|
|
for element in listofsubscriptions:
|
|
|
try:
|
|
|
element.update_data()
|
|
@@ -512,8 +500,7 @@ elif options.update is True:
|
|
|
"database.") % video.title)
|
|
|
|
|
|
elif options.download is True:
|
|
|
- listofsubscriptions = []
|
|
|
- subscriptions = db.GetSubscriptions()
|
|
|
+ listofsubscriptions = db.GetSubscriptions(conf)
|
|
|
logger.debug(_("Trying to determine the itag value for youtube-dl from"
|
|
|
" your quality and codec settings."))
|
|
|
itag_value = conf.GetYoutubeParameter()
|
|
@@ -522,19 +509,10 @@ elif options.download is True:
|
|
|
logger.debug(_("Codec and resolution could not be determined, using "
|
|
|
"maximum possible value."))
|
|
|
itag_value = 38
|
|
|
- for element in subscriptions:
|
|
|
- listofsubscriptions.append(subscription.sub(id=element[0],
|
|
|
- title=element[1],
|
|
|
- type=element[2],
|
|
|
- name=element[3],
|
|
|
- search=element[4],
|
|
|
- directory=element[5],
|
|
|
- disabled=element[6],
|
|
|
- conf=conf))
|
|
|
videosdownloaded = 0
|
|
|
videosfailed = 0
|
|
|
for element in listofsubscriptions:
|
|
|
- videos = db.GetVideos(element.GetId())
|
|
|
+ videos = db.GetVideos(element.GetId(), conf)
|
|
|
element.GatherVideos(videos)
|
|
|
try:
|
|
|
element.DownloadVideos(itag_value)
|
|
@@ -636,7 +614,7 @@ elif options.subscriptionid is not None:
|
|
|
search=Data[0][4],
|
|
|
directory=Data[0][5],
|
|
|
disabled=Data[0][6], conf=conf)
|
|
|
- videos = db.GetVideos(Subscription.GetId())
|
|
|
+ videos = db.GetVideos(Subscription.GetId(), conf)
|
|
|
Subscription.GatherVideos(videos)
|
|
|
video_list = Subscription.PrintVideos()
|
|
|
for video in video_list:
|
|
@@ -662,16 +640,9 @@ elif options.catchup is not None:
|
|
|
|
|
|
|
|
|
elif options.cleanup is True:
|
|
|
- subscriptions_list = []
|
|
|
- subscriptions = db.GetSubscriptions()
|
|
|
- for element in subscriptions:
|
|
|
- subscriptions_list.append(subscription.sub(id=element[0],
|
|
|
- title=element[1], type=element[2],
|
|
|
- name=element[3], search=element[4],
|
|
|
- directory=element[5], disabled=element[6],
|
|
|
- conf=conf))
|
|
|
+ subscriptions_list = db.GetSubscriptions(conf)
|
|
|
for element in subscriptions_list:
|
|
|
- videos = db.GetVideos(element.GetId())
|
|
|
+ videos = db.GetVideos(element.GetId(), conf)
|
|
|
element.CheckAndDelete(videos)
|
|
|
for delete_video in element.ToDelete:
|
|
|
logger.debug(_("Deleting video %s from "
|