def createMovFile(fullfilepath):
    MEDIA_SPECS = [  ### specs in media header
        'QTMovieCurrentSizeAttribute', 'QTMovieCreationTimeAttribute',
        'QTMovieHasAudioAttribute', 'QTMovieHasVideoAttribute',
        'QTMovieTimeScaleAttribute'
    ]

    TRACK_SPECS = [  ### specs in track header
        'QTTrackDisplayNameAttribute', 'QTTrackBoundsAttribute',
        'QTTrackFormatSummaryAttribute', 'QTTrackIDAttribute',
        'QTTrackMediaTypeAttribute'
    ]

    attribs = NSMutableDictionary.dictionary()
    attribs['QTMovieFileNameAttribute'] = fullfilepath

    file = nbc.NBCFile(fullfilepath)
    mov, error = QTKit.QTMovie.alloc().initWithAttributes_error_(
        attribs, objc.nil)  #init mov object
    if error:
        print error, file
    else:
        for track in mov.tracks():  #pull individual tracks
            try:
                tracktype = track.trackAttributes(
                )['QTTrackMediaTypeAttribute']
                if (tracktype == TIMECODE):
                    file.tctrack = track
                elif (tracktype == VIDEO):
                    file.videotrack = track
                    file.codec = 'PRH'  #file.videotrack.trackAttributes()['QTTrackFormatSummaryAttribute']						#get codec
                elif (tracktype == AUDIO):
                    file.audiotracks.append(
                        track.trackAttributes()['QTTrackDisplayNameAttribute'])

            except KeyError, e:
                continue
        try:
            frameRate = mov.duration()[1]  #set framerate
            duration = mov.duration()[0]
            #		print frameRate
            #print duration
            durMinutes = duration / frameRate / 60  #get minutes of duration
            durSeconds = int(
                (round(duration / frameRate / 60.00, 2) -
                 (duration / frameRate / 60)) * 60
            )  #get seconds of duration(fraction of minutes multiplied by 60 to get actual seconds)
            #print durMinutes
            ##print durSeconds
            file.minutes = durMinutes
            file.seconds = durSeconds
            if ((frameRate == 2500) or (frameRate == 25)):
                file.timecode = 'E'
            if ((frameRate == 23976) or (frameRate == 24000)):
                file.timecode = 'P'
            if ((frameRate == 30000) or (frameRate == 2997)):
                file.timecode = 'D'
        except Exception, e:
            print e
示例#2
0
    def _common_init(self):
        """_common_init"""

        self.userNS = NSMutableDictionary.dictionary()
        self.waitingForEngine = False

        self.lines = {}
        self.tabSpaces = 4
        self.tabUsesSpaces = True
        self.currentBlockID = self.next_block_ID()
        self.blockRanges = {}  # blockID=>CellBlock
示例#3
0
 def _common_init(self):
     """_common_init"""
     
     self.userNS = NSMutableDictionary.dictionary()
     self.waitingForEngine = False
     
     self.lines = {}
     self.tabSpaces = 4
     self.tabUsesSpaces = True
     self.currentBlockID = self.next_block_ID()
     self.blockRanges = {} # blockID=>CellBlock
示例#4
0
 def getItemView(self):
     array = NSMutableArray.array()
     context = NSMutableDictionary.dictionary()
     context.setObject_forKey_(self, NSNibOwner)
     context.setObject_forKey_(array, NSNibTopLevelObjects)
     path = NSBundle.mainBundle().pathForResource_ofType_("AlertPanelView", "nib")
     if not NSBundle.loadNibFile_externalNameTable_withZone_(path, context, self.zone()):
         raise RuntimeError("Internal Error. Could not find AlertPanelView.nib")
     for obj in array:
         if isinstance(obj, NSBox):
             return obj
     else:
         raise RuntimeError("Internal Error. Could not find NSBox in AlertPanelView.nib")
def createMovFile(fullfilepath):
	MEDIA_SPECS = [																										### specs in media header
		'QTMovieCurrentSizeAttribute', 'QTMovieCreationTimeAttribute', 'QTMovieHasAudioAttribute',
		'QTMovieHasVideoAttribute', 'QTMovieTimeScaleAttribute']
	
	TRACK_SPECS = [																										### specs in track header
		'QTTrackDisplayNameAttribute', 'QTTrackBoundsAttribute',
		'QTTrackFormatSummaryAttribute', 'QTTrackIDAttribute', 'QTTrackMediaTypeAttribute']

	attribs = NSMutableDictionary.dictionary()
	attribs['QTMovieFileNameAttribute'] = fullfilepath
	
	file = nbc.NBCFile(fullfilepath)
	mov, error = QTKit.QTMovie.alloc().initWithAttributes_error_(attribs,objc.nil)										#init mov object
	if error:
		print error, file
	else:
		for track in mov.tracks():																						#pull individual tracks
			try:			
				tracktype = track.trackAttributes()['QTTrackMediaTypeAttribute']
				if (tracktype == TIMECODE):
					file.tctrack = track
				elif (tracktype == VIDEO):
					file.videotrack = track
					file.codec = 'PRH' #file.videotrack.trackAttributes()['QTTrackFormatSummaryAttribute']						#get codec
				elif (tracktype == AUDIO):
					file.audiotracks.append(track.trackAttributes()['QTTrackDisplayNameAttribute'])
				
			except KeyError, e:
				continue	
		try:
			frameRate = mov.duration()[1]												#set framerate
			duration = mov.duration()[0]
	#		print frameRate
			#print duration
			durMinutes = duration/frameRate/60														#get minutes of duration
			durSeconds = int((round(duration/frameRate/60.00,2)-(duration/frameRate/60))*60)		#get seconds of duration(fraction of minutes multiplied by 60 to get actual seconds)
			#print durMinutes
			##print durSeconds
			file.minutes = durMinutes
			file.seconds = durSeconds
			if ((frameRate == 2500) or (frameRate == 25)):
				file.timecode = 'E'
			if ((frameRate == 23976) or (frameRate == 24000)):
				file.timecode = 'P'
			if ((frameRate == 30000) or (frameRate == 2997)):
				file.timecode = 'D'
		except Exception, e:
			print e
	def printAttributes(self):																							#print out various attributes
		attribs = NSMutableDictionary.dictionary()
		attribs['QTMovieFileNameAttribute'] = self.filename
		mov, error = QTKit.QTMovie.alloc().initWithAttributes_error_(attribs,objc.nil)
		if error:
			print error
		else:
			print 'Duration:',mov.duration()[0]/mov.duration()[1]/60.0
			for i in self.MEDIA_SPECS:
				print i,":", type(mov.movieAttributes()[i])
			for i in mov.tracks():
				for j in self.TRACK_SPECS:
					try:
						print i.trackAttributes()[j]
					except KeyError, e:
						continue	
示例#7
0
 def printAttributes(self):  #print out various attributes
     attribs = NSMutableDictionary.dictionary()
     attribs['QTMovieFileNameAttribute'] = self.filename
     mov, error = QTKit.QTMovie.alloc().initWithAttributes_error_(
         attribs, objc.nil)
     if error:
         print error
     else:
         print 'Duration:', mov.duration()[0] / mov.duration()[1] / 60.0
         for i in self.MEDIA_SPECS:
             print i, ":", type(mov.movieAttributes()[i])
         for i in mov.tracks():
             for j in self.TRACK_SPECS:
                 try:
                     print i.trackAttributes()[j]
                 except KeyError, e:
                     continue
示例#8
0
 def load(cls):
     '''
     Load the all paths from setting file
     :return An array which contain all the directory model
     '''
     settingPath = cls.settingPath()
     fm = NSFileManager.defaultManager()
     paths = NSMutableArray.array()
     settings = NSMutableDictionary.dictionary()
     if fm.fileExistsAtPath_isDirectory_(settingPath, None)[0]:
         settingFile = NSData.dataWithContentsOfFile_(settingPath)
         jsonData = NSJSONSerialization.JSONObjectWithData_options_error_(
             settingFile, 0, None)[0]
         settings['startup'] = jsonData['startup']
         settings['api_key'] = jsonData['api_key']
         for item in jsonData['paths']:
             directory = Directory.alloc().initWithDict_(item)
             paths.addObject_(directory)
         settings['paths'] = paths
     else:
         settings['startup'] = True
         settings['api_key'] = ''
         settings['paths'] = paths
     return settings
示例#9
0
                 'a replacement items list. '
                 'Is this OS version supported?')

# Update entries that already exist
for item in items:
    replace = item.valueForKey_('replace')
    if importedData.has_key(replace):
        importedItem = importedData[replace]
        item.setObject_forKey_(importedItem['enabled'], 'on')
        item.setObject_forKey_(importedItem['replacement'], 'with')
        del importedData[replace]
        updated += 1

# Add new entries
for key, importedItem in importedData.iteritems():
    item = NSMutableDictionary.dictionary()
    item.setObject_forKey_(importedItem['enabled'], 'on')
    item.setObject_forKey_(key, 'replace')
    item.setObject_forKey_(importedItem['replacement'], 'with')
    items.addObject_(item)
    added += 1

# Update the preferences
prefs.setPersistentDomain_forName_(globalPrefs, '.GlobalPreferences')
prefs.synchronize()

# Release the preferences from memory
NSUserDefaults.resetStandardUserDefaults()

# Build notification userInfo object
userInfo = {}
def createMovFile(fullfilepath):
	MEDIA_SPECS = [																										### specs in media header
		'QTMovieCurrentSizeAttribute', 'QTMovieCreationTimeAttribute', 'QTMovieHasAudioAttribute',
		'QTMovieHasVideoAttribute', 'QTMovieTimeScaleAttribute']
	
	TRACK_SPECS = [																										### specs in track header
		'QTTrackDisplayNameAttribute', 'QTTrackBoundsAttribute',
		'QTTrackFormatSummaryAttribute', 'QTTrackIDAttribute', 'QTTrackMediaTypeAttribute']

	attribs = NSMutableDictionary.dictionary()
	attribs['QTMovieFileNameAttribute'] = fullfilepath
	
	file = nbc.NBCFile(fullfilepath)
	mov, error = QTKit.QTMovie.alloc().initWithAttributes_error_(attribs,objc.nil)										#init mov object
	if error:
		print error
	else:
		for track in mov.tracks():																						#pull individual tracks
			try:			
				tracktype = track.trackAttributes()['QTTrackMediaTypeAttribute']
				if (tracktype == TIMECODE):
					file.tctrack = track
				elif (tracktype == VIDEO):
					file.videotrack = track
					file.codec = 'PRH' #file.videotrack.trackAttributes()['QTTrackFormatSummaryAttribute']						#get codec
				elif (tracktype == AUDIO):
					file.audiotracks.append(track.trackAttributes()['QTTrackDisplayNameAttribute'])
				
			except KeyError, e:
				continue	

		frameRate = mov.duration()[1]												#set framerate
		duration = mov.duration()[0]
		print frameRate
		#print duration
		durMinutes = duration/frameRate/60														#get minutes of duration
		durSeconds = int((round(duration/frameRate/60.00,2)-(duration/frameRate/60))*60)		#get seconds of duration(fraction of minutes multiplied by 60 to get actual seconds)
		#print durMinutes
		##print durSeconds
		file.minutes = durMinutes
		file.seconds = durSeconds
		if ((frameRate == 2500) or (frameRate == 25)):
			file.timecode = 'E'
		if (frameRate == 23976):
			file.timecode = 'P'
		if (frameRate == 30000):
			file.timecode = 'D'

		if (file.videotrack.currentSize().height > 1050 and file.videotrack.currentSize().height < 1110):				#set standard with height
			if (file.timecode == 'P'):
				file.standard = 3																						#MVIS CODES: 3 - 1080-2398
			if (file.timecode == 'E'):
				file.standard = 2																						#... 2 - 1080 50i
			if (file.timecode == 'D'):
				file.standard = 1																						#... 1 - 1080 5994i
		elif (file.videotrack.currentSize().height > 470 and file.videotrack.currentSize().height < 490):
			file.standard = 'N'																							#... N - NTSC
		elif (file.videotrack.currentSize().height > 560 and file.videotrack.currentSize().height < 590):
			file.standard = 'P'																							#... P - PAL
		else:
			file.standard = None
示例#11
0
                 'a replacement items list. '
                 'Is this OS version supported?')

# Update entries that already exist
for item in items:
    replace = item.valueForKey_('replace')
    if importedData.has_key(replace):
        importedItem = importedData[replace]
        item.setObject_forKey_(importedItem['enabled'], 'on')
        item.setObject_forKey_(importedItem['replacement'], 'with')
        del importedData[replace]
        updated += 1

# Add new entries
for key, importedItem in importedData.iteritems():
    item = NSMutableDictionary.dictionary()
    item.setObject_forKey_(importedItem['enabled'], 'on')
    item.setObject_forKey_(key, 'replace')
    item.setObject_forKey_(importedItem['replacement'], 'with')
    items.addObject_(item)
    added += 1

# Update the preferences
prefs.setPersistentDomain_forName_(globalPrefs, '.GlobalPreferences')
prefs.synchronize()

# Release the preferences from memory
NSUserDefaults.resetStandardUserDefaults()

# Build notification userInfo object
userInfo = {}
示例#12
0
def createMovFile(fullfilepath):
    MEDIA_SPECS = [  ### specs in media header
        'QTMovieCurrentSizeAttribute', 'QTMovieCreationTimeAttribute',
        'QTMovieHasAudioAttribute', 'QTMovieHasVideoAttribute',
        'QTMovieTimeScaleAttribute'
    ]

    TRACK_SPECS = [  ### specs in track header
        'QTTrackDisplayNameAttribute', 'QTTrackBoundsAttribute',
        'QTTrackFormatSummaryAttribute', 'QTTrackIDAttribute',
        'QTTrackMediaTypeAttribute'
    ]

    attribs = NSMutableDictionary.dictionary()
    attribs['QTMovieFileNameAttribute'] = fullfilepath

    file = nbc.NBCFile(fullfilepath)
    mov, error = QTKit.QTMovie.alloc().initWithAttributes_error_(
        attribs, objc.nil)  #init mov object
    if error:
        print error
    else:
        for track in mov.tracks():  #pull individual tracks
            try:
                tracktype = track.trackAttributes(
                )['QTTrackMediaTypeAttribute']
                if (tracktype == TIMECODE):
                    file.tctrack = track
                elif (tracktype == VIDEO):
                    file.videotrack = track
                    file.codec = 'PRH'  #file.videotrack.trackAttributes()['QTTrackFormatSummaryAttribute']						#get codec
                elif (tracktype == AUDIO):
                    file.audiotracks.append(
                        track.trackAttributes()['QTTrackDisplayNameAttribute'])

            except KeyError, e:
                continue

        frameRate = mov.duration()[1]  #set framerate
        duration = mov.duration()[0]
        print frameRate
        #print duration
        durMinutes = duration / frameRate / 60  #get minutes of duration
        durSeconds = int(
            (round(duration / frameRate / 60.00, 2) -
             (duration / frameRate / 60)) * 60
        )  #get seconds of duration(fraction of minutes multiplied by 60 to get actual seconds)
        #print durMinutes
        ##print durSeconds
        file.minutes = durMinutes
        file.seconds = durSeconds
        if ((frameRate == 2500) or (frameRate == 25)):
            file.timecode = 'E'
        if (frameRate == 23976):
            file.timecode = 'P'
        if (frameRate == 30000):
            file.timecode = 'D'

        if (file.videotrack.currentSize().height > 1050
                and file.videotrack.currentSize().height <
                1110):  #set standard with height
            if (file.timecode == 'P'):
                file.standard = 3  #MVIS CODES: 3 - 1080-2398
            if (file.timecode == 'E'):
                file.standard = 2  #... 2 - 1080 50i
            if (file.timecode == 'D'):
                file.standard = 1  #... 1 - 1080 5994i
        elif (file.videotrack.currentSize().height > 470
              and file.videotrack.currentSize().height < 490):
            file.standard = 'N'  #... N - NTSC
        elif (file.videotrack.currentSize().height > 560
              and file.videotrack.currentSize().height < 590):
            file.standard = 'P'  #... P - PAL
        else:
            file.standard = None
from Foundation import NSMutableDictionary
from Foundation import NSMutableArray
if not PLIST_APPLICATION_INFO_LOCATION:
   print '[ERROR] Cannot find plist file %(PLIST_APPLICATION_INFO_LOCATION)'
   sys.exit(1)
application_info = NSMutableDictionary.dictionaryWithContentsOfFile_(PLIST_APPLICATION_INFO_LOCATION)
PLIST_BUNDLE_IDENTIFIER = application_info.objectForKey_('CFBundleIdentifier')
if PLIST_BUNDLE_IDENTIFIER_SUFFIX != '':
   PLIST_BUNDLE_IDENTIFIER = PLIST_BUNDLE_IDENTIFIER + PLIST_BUNDLE_IDENTIFIER_SUFFIX
PLIST_BUNDLE_VERSION = application_info.objectForKey_('CFBundleVersion')
print '[DEBUG] Bundle identifier = %(PLIST_BUNDLE_IDENTIFIER)s' % vars()
print '[DEBUG] Bundle version    = %(PLIST_BUNDLE_VERSION)s' % vars()


root = NSMutableDictionary.dictionary()
items = NSMutableArray.array()
root.setObject_forKey_(items,'items')
main_item = NSMutableDictionary.dictionary()
items.addObject_(main_item)

assets = NSMutableArray.array()
main_item['assets'] = assets

asset_item = NSMutableDictionary.dictionary()

assets.addObject_(asset_item)
asset_item['kind'] = 'software-package'
asset_item['url'] = IPA_URL

metadata = NSMutableDictionary.dictionary()