def addSelectedFeature(self, movieid=None, episodeid=None, selection=False): if selection or movieid or episodeid: return self.addFromID(movieid, episodeid, selection) if xbmc.getCondVisibility('ListItem.IsCollection'): kodiutil.DEBUG_LOG('Selection is a collection') return self.addCollectionMovies() title = kodiutil.infoLabel('ListItem.Title') if not title: return False feature = cinemavision.sequenceprocessor.Feature( kodiutil.infoLabel('ListItem.FileNameAndPath')) feature.title = title ratingString = cvutil.ratingParser().getActualRatingFromMPAA( kodiutil.infoLabel('ListItem.Mpaa'), debug=True) if ratingString: feature.rating = ratingString feature.ID = kodiutil.intOrZero(xbmc.getInfoLabel('ListItem.DBID')) feature.dbType = xbmc.getInfoLabel('ListItem.DBTYPE') feature.genres = kodiutil.infoLabel('ListItem.Genre').split(' / ') feature.thumb = kodiutil.infoLabel('ListItem.Thumb') feature.year = kodiutil.infoLabel('ListItem.Year') try: feature.runtime = kodiutil.intOrZero( xbmc.getInfoLabel('ListItem.Duration')) * 60 except TypeError: pass feature.is3D = xbmc.getCondVisibility('ListItem.IsStereoscopic') if not feature.is3D: tags3DRegEx = kodiutil.getSetting('3D.tag.regex', cvutil.DEFAULT_3D_RE) feature.is3D = bool(re.search(tags3DRegEx, feature.path)) codec = xbmc.getInfoLabel('ListItem.AudioCodec') channels = kodiutil.intOrZero( xbmc.getInfoLabel('ListItem.AudioChannels')) if codec: feature.audioFormat = AUDIO_FORMATS.get(codec) feature.codec = codec feature.channels = channels DEBUG_LOG('CODEC ({0}): {1} ({2} channels)'.format( kodiutil.strRepr(feature.title), codec, channels or '?')) else: DEBUG_LOG('CODEC ({0}): NOT DETECTED'.format( kodiutil.strRepr(feature.title))) self.features.append(feature) return True
def featureFromJSON(self, r): tags3DRegEx = kodiutil.getSetting('3D.tag.regex', cvutil.DEFAULT_3D_RE) feature = cinemavision.sequenceprocessor.Feature(r['file']) feature.title = r.get('title') or r.get('label', '') ratingString = cvutil.ratingParser().getActualRatingFromMPAA( r.get('mpaa', ''), debug=True) if ratingString: feature.rating = ratingString feature.ID = kodiutil.intOrZero( r.get('movieid', r.get('episodeid', r.get('id', 0)))) feature.dbType = r.get('type', '') feature.genres = r.get('genre', []) feature.tags = r.get('tag', []) feature.studios = r.get('studio', []) feature.directors = r.get('director', []) feature.cast = r.get('cast', []) feature.thumb = r.get('thumbnail', '') feature.runtime = r.get('runtime', 0) feature.year = r.get('year', 0) try: stereomode = r['streamdetails']['video'][0]['stereomode'] except: stereomode = '' if stereomode not in ('mono', ''): feature.is3D = True else: feature.is3D = bool(re.search(tags3DRegEx, r['file'])) try: codec, channels = self.getCodecAndChannelsFromStreamDetails( r['streamdetails']) DEBUG_LOG('CODEC ({0}): {1} ({2} channels)'.format( kodiutil.strRepr(feature.title), codec, channels or '?')) DEBUG_LOG('STREAMDETAILS: \n{0}'.format( self.formatStreamDetails(r.get('streamdetails')))) feature.audioFormat = AUDIO_FORMATS.get(codec) feature.codec = codec feature.channels = channels except: kodiutil.ERROR() DEBUG_LOG('CODEC ({0}): NOT DETECTED'.format( kodiutil.strRepr(feature.title))) DEBUG_LOG('STREAMDETAILS: {0}'.format(repr( r.get('streamdetails')))) return feature
def addSelectedFeature(self, movieid=None, episodeid=None, selection=False): if selection or movieid or episodeid: return self.addFromID(movieid, episodeid, selection) if xbmc.getCondVisibility('ListItem.IsCollection'): kodiutil.DEBUG_LOG('Selection is a collection') return self.addCollectionMovies() title = kodiutil.infoLabel('ListItem.Title') if not title: return False feature = cinemavision.sequenceprocessor.Feature(kodiutil.infoLabel('ListItem.FileNameAndPath')) feature.title = title ratingString = cvutil.ratingParser().getActualRatingFromMPAA(kodiutil.infoLabel('ListItem.Mpaa'), debug=True) if ratingString: feature.rating = ratingString feature.ID = kodiutil.intOrZero(xbmc.getInfoLabel('ListItem.DBID')) feature.dbType = xbmc.getInfoLabel('ListItem.DBTYPE') feature.genres = kodiutil.infoLabel('ListItem.Genre').split(' / ') feature.thumb = kodiutil.infoLabel('ListItem.Thumb') feature.year = kodiutil.infoLabel('ListItem.Year') try: feature.runtime = kodiutil.intOrZero(xbmc.getInfoLabel('ListItem.Duration')) * 60 except TypeError: pass feature.is3D = xbmc.getCondVisibility('ListItem.IsStereoscopic') if not feature.is3D: tags3DRegEx = kodiutil.getSetting('3D.tag.regex', cvutil.DEFAULT_3D_RE) feature.is3D = bool(re.search(tags3DRegEx, feature.path)) codec = xbmc.getInfoLabel('ListItem.AudioCodec') channels = kodiutil.intOrZero(xbmc.getInfoLabel('ListItem.AudioChannels')) if codec: feature.audioFormat = AUDIO_FORMATS.get(codec) feature.codec = codec feature.channels = channels DEBUG_LOG('CODEC ({0}): {1} ({2} channels)'.format(kodiutil.strRepr(feature.title), codec, channels or '?')) else: DEBUG_LOG('CODEC ({0}): NOT DETECTED'.format(kodiutil.strRepr(feature.title))) self.features.append(feature) return True
def featureFromJSON(self, r): tags3DRegEx = kodiutil.getSetting('3D.tag.regex', cvutil.DEFAULT_3D_RE) feature = cinemavision.sequenceprocessor.Feature(r['file']) feature.title = r.get('title') or r.get('label', '') ratingString = cvutil.ratingParser().getActualRatingFromMPAA(r.get('mpaa', ''), debug=True) if ratingString: feature.rating = ratingString feature.ID = kodiutil.intOrZero(r.get('movieid', r.get('episodeid', r.get('id', 0)))) feature.dbType = r.get('type', '') feature.genres = r.get('genre', []) feature.thumb = r.get('thumbnail', '') feature.runtime = r.get('runtime', 0) feature.year = r.get('year', 0) try: stereomode = r['streamdetails']['video'][0]['stereomode'] except: stereomode = '' if stereomode not in ('mono', ''): feature.is3D = True else: feature.is3D = bool(re.search(tags3DRegEx, r['file'])) try: codec, channels = self.getCodecAndChannelsFromStreamDetails(r['streamdetails']) DEBUG_LOG('CODEC ({0}): {1} ({2} channels)'.format(kodiutil.strRepr(feature.title), codec, channels or '?')) DEBUG_LOG('STREAMDETAILS: {0}'.format(repr(r.get('streamdetails')))) feature.audioFormat = AUDIO_FORMATS.get(codec) feature.codec = codec feature.channels = channels except: DEBUG_LOG('CODEC ({0}): NOT DETECTED'.format(kodiutil.strRepr(feature.title))) DEBUG_LOG('STREAMDETAILS: {0}'.format(repr(r.get('streamdetails')))) return feature
import time import calendar import xbmcgui import kodigui import kodiutil import cvutil import cinemavision from kodijsonrpc import rpc cvutil.ratingParser() class SeqAttrEditorDialog(kodigui.BaseDialog): xmlFile = 'script.cinemavision-sequence-attribute-editor.xml' path = kodiutil.ADDON_PATH theme = 'Main' res = '1080i' ATTRIBUTE_LIST_ID = 300 SLIDER_ID = 401 def __init__(self, *args, **kwargs): kodigui.BaseDialog.__init__(self, *args, **kwargs) self.sequenceData = kwargs['sequence_data'] self.modified = False self.attributeList = None self.options = [] def onFirstInit(self):