Merge branch 'saas-dev' into soundcloud
This commit is contained in:
commit
f243014d9f
271 changed files with 123614 additions and 117677 deletions
17
python_apps/pypo/pypo/mime.types
Normal file
17
python_apps/pypo/pypo/mime.types
Normal file
|
@ -0,0 +1,17 @@
|
|||
audio/ogg ogg
|
||||
application/ogg ogg
|
||||
audio/vorbis ogg
|
||||
audio/mp3 mp3
|
||||
audio/mpeg mp3
|
||||
audio/mpeg3 mp3
|
||||
audio/x-aac aac
|
||||
audio/aac aac
|
||||
audio/aacp aac
|
||||
audio/mp4 m4a
|
||||
audio/x-flac flac
|
||||
audio/wav wav
|
||||
audio/x-wav wav
|
||||
audio/mp2 mp2
|
||||
audio/mp1 mp1
|
||||
audio/x-ms-wma wma
|
||||
audio/basic au
|
|
@ -12,7 +12,7 @@ import signal
|
|||
from datetime import datetime
|
||||
import traceback
|
||||
import pure
|
||||
|
||||
import mimetypes
|
||||
from Queue import Empty
|
||||
from threading import Thread, Timer
|
||||
from subprocess import Popen, PIPE
|
||||
|
@ -345,9 +345,8 @@ class PypoFetch(Thread):
|
|||
for key in media:
|
||||
media_item = media[key]
|
||||
if (media_item['type'] == 'file'):
|
||||
self.sanity_check_media_item(media_item)
|
||||
fileExt = os.path.splitext(media_item['uri'])[1]
|
||||
dst = os.path.join(download_dir, unicode(media_item['id']) + fileExt)
|
||||
fileExt = self.sanity_check_media_item(media_item)
|
||||
dst = os.path.join(download_dir, unicode(media_item['id']) + unicode(fileExt))
|
||||
media_item['dst'] = dst
|
||||
media_item['file_ready'] = False
|
||||
media_filtered[key] = media_item
|
||||
|
@ -377,6 +376,10 @@ class PypoFetch(Thread):
|
|||
start = datetime.strptime(media_item['start'], "%Y-%m-%d-%H-%M-%S")
|
||||
end = datetime.strptime(media_item['end'], "%Y-%m-%d-%H-%M-%S")
|
||||
|
||||
mime = media_item['metadata']['mime']
|
||||
mimetypes.init(["%s/mime.types" % os.path.dirname(os.path.realpath(__file__))])
|
||||
mime_ext = mimetypes.guess_extension(mime, strict=False)
|
||||
|
||||
length1 = pure.date_interval_to_seconds(end - start)
|
||||
length2 = media_item['cue_out'] - media_item['cue_in']
|
||||
|
||||
|
@ -385,6 +388,10 @@ class PypoFetch(Thread):
|
|||
self.logger.error("cue_out - cue_in length: %s", length2)
|
||||
self.logger.error("Two lengths are not equal!!!")
|
||||
|
||||
media_item['file_ext'] = mime_ext
|
||||
|
||||
return mime_ext
|
||||
|
||||
def is_file_opened(self, path):
|
||||
#Capture stderr to avoid polluting py-interpreter.log
|
||||
proc = Popen(["lsof", path], stdout=PIPE, stderr=PIPE)
|
||||
|
@ -403,8 +410,7 @@ class PypoFetch(Thread):
|
|||
for mkey in media:
|
||||
media_item = media[mkey]
|
||||
if media_item['type'] == 'file':
|
||||
fileExt = os.path.splitext(media_item['uri'])[1]
|
||||
scheduled_file_set.add(unicode(media_item["id"]) + fileExt)
|
||||
scheduled_file_set.add(unicode(media_item["id"]) + unicode(media_item["file_ext"]))
|
||||
|
||||
expired_files = cached_file_set - scheduled_file_set
|
||||
|
||||
|
|
|
@ -61,7 +61,7 @@ class PypoFile(Thread):
|
|||
media_item['file_ready'] = not do_copy
|
||||
|
||||
if do_copy:
|
||||
self.logger.debug("copying from %s to local cache %s" % (src, dst))
|
||||
self.logger.info("copying from %s to local cache %s" % (src, dst))
|
||||
try:
|
||||
CONFIG_SECTION = "general"
|
||||
username = self._config.get(CONFIG_SECTION, 'api_key')
|
||||
|
|
|
@ -39,7 +39,7 @@ setup(name='airtime-playout',
|
|||
license='AGPLv3',
|
||||
packages=['pypo', 'pypo.media', 'pypo.media.update',
|
||||
'liquidsoap', 'liquidsoap.library'],
|
||||
package_data={'': ['*.liq', '*.cfg']},
|
||||
package_data={'': ['*.liq', '*.cfg', '*.types']},
|
||||
scripts=[
|
||||
'bin/airtime-playout',
|
||||
'bin/airtime-liquidsoap',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue