initial commit
This commit is contained in:
commit
031b0c8f1e
2
README.md
Normal file
2
README.md
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
Installation:
|
||||||
|
git clone git@www.0x50.de:rschaten/script.cinematic.git script.cinemavision
|
70
addon.py
Normal file
70
addon.py
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
import xbmc
|
||||||
|
import xbmcgui
|
||||||
|
import xbmcaddon
|
||||||
|
import xbmcvfs
|
||||||
|
import json
|
||||||
|
import random
|
||||||
|
import sys
|
||||||
|
|
||||||
|
ADDON = xbmcaddon.Addon()
|
||||||
|
CWD = ADDON.getAddonInfo('path').decode('utf-8')
|
||||||
|
#CWD = ADDON.getAddonInfo('path') # for kodi 19
|
||||||
|
|
||||||
|
def files_from_dir(count, location):
|
||||||
|
print("fetching %d files from %s" % (count, location))
|
||||||
|
dirs, files = xbmcvfs.listdir(location)
|
||||||
|
files = random.sample(files, count)
|
||||||
|
for i in range(len(files)):
|
||||||
|
files[i] = location + files[i]
|
||||||
|
return files
|
||||||
|
|
||||||
|
def trailers_from_net(count, genre, rating):
|
||||||
|
files = []
|
||||||
|
for i in range(count):
|
||||||
|
files.append("TODO: find trailer %d" % i)
|
||||||
|
return files
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
for arg in sys.argv[1:]:
|
||||||
|
(name, value) = arg.split('=')
|
||||||
|
if name == 'dbid':
|
||||||
|
dbid = int(value)
|
||||||
|
|
||||||
|
path = ADDON.getSettingString('cinematic_path')
|
||||||
|
dirs, files = xbmcvfs.listdir(path)
|
||||||
|
programs = []
|
||||||
|
for filename in files:
|
||||||
|
if filename.endswith('.json'):
|
||||||
|
programs.append(filename)
|
||||||
|
|
||||||
|
dialog = xbmcgui.Dialog()
|
||||||
|
ret = dialog.select('Cinematic: Select a program', programs)
|
||||||
|
del dialog
|
||||||
|
|
||||||
|
program_file = path + programs[ret]
|
||||||
|
|
||||||
|
filehandle = xbmcvfs.File(program_file)
|
||||||
|
program_json = filehandle.read()
|
||||||
|
filehandle.close()
|
||||||
|
|
||||||
|
program_data = json.loads(program_json)
|
||||||
|
|
||||||
|
print("=== conducting program %s" % program_data['name'])
|
||||||
|
filelist = []
|
||||||
|
for item in program_data['items']:
|
||||||
|
print("selecting %s" % item['name'])
|
||||||
|
settings = item['settings']
|
||||||
|
if settings['source'] == 'file':
|
||||||
|
filelist.append(settings['location'])
|
||||||
|
elif settings['source'] == 'dir':
|
||||||
|
filelist.extend(files_from_dir(settings['count'], settings['location']))
|
||||||
|
elif settings['source'] == 'trailer':
|
||||||
|
genre = 'TODO: find feature genre'
|
||||||
|
rating = 'TODO: find feature rating'
|
||||||
|
filelist.extend(trailers_from_net(settings['count'], genre, rating))
|
||||||
|
elif settings['source'] == 'feature':
|
||||||
|
filelist.append("TODO: find feature %d" % dbid)
|
||||||
|
|
||||||
|
print('=== playlist')
|
||||||
|
for filename in filelist:
|
||||||
|
print(" * %s" % filename)
|
15
addon.xml
Normal file
15
addon.xml
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||||
|
<addon id="script.cinemavision" name="Cinematic" version="0.1" provider-name="Cinematic">
|
||||||
|
<requires>
|
||||||
|
<import addon="xbmc.python" version="2.25.0"/>
|
||||||
|
</requires>
|
||||||
|
<extension point="xbmc.python.script" library="addon.py">
|
||||||
|
<provides>executable</provides>
|
||||||
|
</extension>
|
||||||
|
<extension point="xbmc.addon.metadata">
|
||||||
|
<summary lang="en">Execute a movie theater like workflow.</summary>
|
||||||
|
<description lang="en">Idea taken from the seemingly abandoned CinemaVision plugin.</description>
|
||||||
|
<language></language>
|
||||||
|
<platform>all</platform>
|
||||||
|
</extension>
|
||||||
|
</addon>
|
6
resources/settings.xml
Normal file
6
resources/settings.xml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
|
||||||
|
<settings>
|
||||||
|
<category label="Locations">
|
||||||
|
<setting id="cinematic_path" label="Main Directory" type="folder" source="files" />
|
||||||
|
</category>
|
||||||
|
</settings>
|
Loading…
Reference in New Issue
Block a user