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,21 +533,36 @@ class PysonicSubsonicApi(object):
# Podcast related endpoints # Podcast related endpoints
@cherrypy.expose @cherrypy.expose
@formatresponse @formatresponse
def getPodcasts_view(self, includeEpisodes=False, **kwargs): def getPodcasts_view(self, id=None, includeEpisodes=True, **kwargs):
#TODO implement includeEpisodes #TODO implement includeEpisodes properly
response = ApiResponse() response = ApiResponse()
response.add_child("podcasts") response.add_child("podcasts")
for podcast in self.library.get_podcasts(): for podcast in self.library.get_podcasts():
response.add_child("channel", node = response.add_child("channel",
_parent="podcasts", _parent="podcasts",
id=podcast["id"], id=podcast["id"],
title=podcast["title"], title=podcast["title"],
url=podcast["url"], url=podcast["url"],
description=podcast["description"], description=podcast["description"],
# coverArt="pl-1" # coverArt="pl-1"
# originalImageUrl="", # originalImageUrl="",
status="completed" # or "downloading" 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 return response
@cherrypy.expose @cherrypy.expose

View File

@ -489,6 +489,6 @@ class PysonicDatabase(object):
@readcursor @readcursor
def set_podcast_episode_status(self, cursor, episode_id, status): 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("UPDATE podcast_episodes SET status=? WHERE id=?", (status, episode_id, ))
cursor.execute("COMMIT") 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 concurrent.futures import ThreadPoolExecutor
from queue import Queue from queue import Queue
from contextlib import closing
import shutil import shutil
import logging import logging
import os import os
@ -86,6 +85,7 @@ class PodcastManager(Thread):
# for item in self.db.get_podcasts(): # for item in self.db.get_podcasts():
# self.refresh_podcast(item) # self.refresh_podcast(item)
logging.info("podcast refresh complete") logging.info("podcast refresh complete")
#TODO all episodes in 'new' status change to 'skipped'
def refresh_podcast(self, podcast): def refresh_podcast(self, podcast):
""" """