forked from 0x2620/pandora
88 lines
1.9 KiB
Python
88 lines
1.9 KiB
Python
# Create your views here.
|
|
|
|
'''
|
|
GET info?oshash=a41cde31c581e11d
|
|
> {
|
|
"movie_id": 0123456,
|
|
"duration": 5.266667,
|
|
"video_codec": "mpeg1",
|
|
"pixel_format": "yuv420p",
|
|
"width": 352,
|
|
"height": 240,
|
|
"pixel_aspect_ratio": "1:1",
|
|
"display_aspect_ratio": "22:15",
|
|
"framerate": "30:1",
|
|
"audio_codec": "mp2",
|
|
"samplerate": 44100,
|
|
"channels": 1,
|
|
"path": "E/Example, The/An Example.avi",
|
|
"size": 1646274
|
|
"oshash": "a41cde31c581e11d",
|
|
"sha1":..,
|
|
"md5":..
|
|
}
|
|
'''
|
|
def file_info(request):
|
|
oshash = request.GET['oshash']
|
|
|
|
|
|
'''
|
|
GET subtitles?oshash=a41cde31c581e11d
|
|
> {
|
|
"languages": ['en', 'fr', 'de']
|
|
}
|
|
GET subtitles?oshash=a41cde31c581e11d&language=en
|
|
> srt file
|
|
POST subtitle?oshash=a41cde31c581e11d&language=en
|
|
srt =
|
|
'''
|
|
def subtitles(request):
|
|
oshash = request.GET['oshash']
|
|
language = request.GET.get('language', None)
|
|
if language:
|
|
return srt
|
|
return movie.subtitle_languages()
|
|
|
|
'''
|
|
GET list
|
|
> {
|
|
"files": {
|
|
"a41cde31c581e11d": {"path": "E/Example, The/An Example.avi", "size":1646274},
|
|
}
|
|
}
|
|
'''
|
|
def list_files(request):
|
|
files = {}
|
|
return dict(files=files)
|
|
|
|
'''
|
|
POST add
|
|
> {
|
|
"duration": 5.266667,
|
|
"video_codec": "mpeg1",
|
|
"pixel_format": "yuv420p",
|
|
"width": 352,
|
|
"height": 240,
|
|
"pixel_aspect_ratio": "1:1",
|
|
"display_aspect_ratio": "22:15",
|
|
"framerate": "30:1",
|
|
"audio_codec": "mp2",
|
|
"samplerate": 44100,
|
|
"channels": 1,
|
|
"path": "E/Example, The/An Example.avi",
|
|
"size": 1646274
|
|
"oshash": "a41cde31c581e11d",
|
|
"sha1":..,
|
|
"md5":..
|
|
}
|
|
'''
|
|
def add_file(request):
|
|
oshash = request.POST['oshash']
|
|
|
|
'''
|
|
POST remove?oshash=
|
|
'''
|
|
def remove_file(request):
|
|
oshash = request.POST['oshash']
|
|
|
|
|