some things

This commit is contained in:
dave 2018-09-21 13:49:30 -07:00
parent 30c641fbea
commit 122addbfa9
3 changed files with 30 additions and 15 deletions

View File

@ -533,12 +533,13 @@ class PysonicSubsonicApi(object):
# Podcast related endpoints
@cherrypy.expose
@formatresponse
def getPodcasts_view(self, includeEpisodes=False, **kwargs):
#TODO implement includeEpisodes
def getPodcasts_view(self, id=None, includeEpisodes=True, **kwargs):
#TODO implement includeEpisodes properly
response = ApiResponse()
response.add_child("podcasts")
for podcast in self.library.get_podcasts():
response.add_child("channel",
node = response.add_child("channel",
_parent="podcasts",
id=podcast["id"],
title=podcast["title"],
@ -548,6 +549,20 @@ class PysonicSubsonicApi(object):
# originalImageUrl="",
status="completed" # or "downloading"
)
if includeEpisodes:
for episode in self.library.db.get_podcast_episodes(podcast_id=podcast['id']):
response.add_child("episode",
_real_parent=node, # what the actual fuck does this do
isDir="false",
title=episode["title"],
id=episode["id"],
duration="420",
description=episode["description"],
status=episode["status"]
)
# publishDate="2018-03-29T01:00:00.000Z"/>
return response
@cherrypy.expose

View File

@ -489,6 +489,6 @@ class PysonicDatabase(object):
@readcursor
def set_podcast_episode_status(self, cursor, episode_id, status):
assert status in ["new", "downloading", "completed"]
assert status in ["new", "skipped", "downloading", "completed"]
cursor.execute("UPDATE podcast_episodes SET status=? WHERE id=?", (status, episode_id, ))
cursor.execute("COMMIT")

View File

@ -1,7 +1,6 @@
from threading import Thread, Lock, Timer
from threading import Thread, Timer
from concurrent.futures import ThreadPoolExecutor
from queue import Queue
from contextlib import closing
import shutil
import logging
import os
@ -86,6 +85,7 @@ class PodcastManager(Thread):
# for item in self.db.get_podcasts():
# self.refresh_podcast(item)
logging.info("podcast refresh complete")
#TODO all episodes in 'new' status change to 'skipped'
def refresh_podcast(self, podcast):
"""