def rename(self) : print('Renaming') for folder in self.rename_watchs : for name in os.listdir(folder) : src = os.path.join(folder, name) if name[0] != '#' and Tools.is_media(src) : renamer = AVRenamer(src, self.sql) renamer.rename() tools.split_line()
def rename(self) : print('Renaming') self.rename_watchs.append(os.path.join(self.work_new, '#rename')) for folder in self.rename_watchs : for name in os.listdir(folder) : src = os.path.join(folder, name) if name[0] != '#' and Tools.is_archive(src) : renamer = HCGRenamer(src, self.sql) renamer.rename() print('-'*150)
def start(self): """ :summary: is called in the start() function, contains the main UI for the scripts :parameter: none :return: nothing """ self.typeCol = cmds.columnLayout(self.col, parent=self.window, w=self.width) """ # section one frameLayout1 = cmds.frameLayout(width=self.width, label="Rocks", collapse=True, collapsable=True, marginHeight=10, marginWidth=5, parent=self.typeCol, ec=partial(frameCollapseChanged, str(self.col)), cc=partial(frameCollapseChanged, str(self.col))) cmds.rowColumnLayout(numberOfColumns=1, columnWidth=[(1, self.width - 10)], parent=frameLayout1, co=[1, "both", 5]) cmds.text("stuff") """ # section two frameLayoutFence = cmds.frameLayout(width=self.width, label="Fences", collapse=True, collapsable=True, marginHeight=10, marginWidth=5, parent=self.typeCol, ec=partial(frameCollapseChanged, str(self.col)), cc=partial(frameCollapseChanged, str(self.col))) cmds.rowColumnLayout(numberOfColumns=2, columnWidth=[(1, (self.width - 20) / 2.0), (2, (self.width - 20) / 2.0)], parent=frameLayoutFence, co=[1, "both", 5]) cmds.button(label="Curve", h=20, command=lambda args: fl.Logger().curve("curve")) cmds.textField("curve", en=False, text="None", height=20) cmds.button(label="Post", h=20, command=lambda args: fl.Logger().fencePost("post")) cmds.textField("post", en=False, text="None", height=20) cmds.button(label="Picket", h=20, command=lambda args: fl.Logger().fencePicket("picket")) cmds.textField("picket", en=False, text="None", height=20) cmds.rowColumnLayout(numberOfColumns=1, columnWidth=[(1, self.width - 10)], parent=frameLayoutFence, co=[1, "both", 5]) cmds.floatSliderGrp('spacing', label='Picket Spacing', field=True, minValue=1, maxValue=100, value=1, columnWidth=[(1, 100), (2, 50), (3, self.width - 150)], cal=[1, "center"]) cmds.intSliderGrp('postNum', label='Number of Posts', field=True, minValue=2, maxValue=30, value=2, step=2, columnWidth=[(1, 100), (2, 50), (3, self.width - 150)], cal=[1, "center"]) cmds.text("Cross Beams", height=20) cmds.text("select edge-loop location on post") cmds.rowColumnLayout(numberOfColumns=2, columnWidth=[(1, (self.width - 20) / 2.0), (2, (self.width - 20) / 2.0)], parent=frameLayoutFence, co=[1, "both", 5]) cmds.button(label="Location One", h=20, command=lambda args: fl.Logger().logLoop_1("locationOne")) cmds.textField("locationOne", en=False, text="None", height=20) cmds.button(label="Location Two", h=20, command=lambda args: fl.Logger().logLoop_2("locationTwo")) cmds.textField("locationTwo", en=False, text="None", height=20) cmds.button( label="Location Three", h=20, command=lambda args: fl.Logger().logLoop_3("locationThree")) cmds.textField("locationThree", en=False, text="None", height=20) cmds.button(label="Location Four", h=20, command=lambda args: fl.Logger().logLoop_4("locationFour")) cmds.textField("locationFour", en=False, text="None", height=20) cmds.rowColumnLayout(numberOfColumns=1, columnWidth=[(1, self.width - 10)], parent=frameLayoutFence, co=[1, "both", 5]) cmds.intSliderGrp('sidesNum', label='Number of Sides', field=True, minValue=3, maxValue=30, value=1, columnWidth=[(1, 100), (2, 50), (3, self.width - 150)], cal=[1, "center"]) cmds.floatSliderGrp('crossWidth', label='Width', field=True, minValue=5, maxValue=75, value=1, columnWidth=[(1, 100), (2, 50), (3, self.width - 150)], cal=[1, "center"]) cmds.floatSliderGrp('crossHeight', label='Height', field=True, minValue=5, maxValue=75, value=1, columnWidth=[(1, 100), (2, 50), (3, self.width - 150)], cal=[1, "center"]) cmds.rowColumnLayout(numberOfColumns=1, columnWidth=[(1, self.width - 10)], parent=frameLayoutFence, co=[1, "both", 5]) cmds.button( label="Test", h=20, command=lambda args: (fl.Logger().confirm(), nl.FindPositions().postPositions())) # section three frameLayoutStacking = cmds.frameLayout( width=self.width, label="Stacking Objects", collapse=True, collapsable=True, marginHeight=10, marginWidth=5, parent=self.typeCol, ec=partial(frameCollapseChanged, str(self.col)), cc=partial(frameCollapseChanged, str(self.col))) cmds.rowColumnLayout(numberOfColumns=1, columnWidth=[(1, self.width - 10)], parent=frameLayoutStacking, co=[1, "both", 5]) cmds.text("Load In Objects") cmds.rowColumnLayout(numberOfColumns=3, columnWidth=[ (1, (self.width - 10) / 3.0), (2, (self.width - 10) / 3.0), (3, (self.width - 10) / 3.0), ], parent=frameLayoutStacking, co=[1, "both", 5]) cmds.button("Object One", command=lambda args: st.LogObjects().saveObject( "object_one", 1)) # 1 cmds.textField("object_one", en=False, text="None") cmds.button( "Clear One", command=lambda args: st.LogObjects().deleteObject("object_one", 1)) cmds.button("Object Two", command=lambda args: st.LogObjects().saveObject( "object_two", 2)) # 2 cmds.textField("object_two", en=False, text="None") cmds.button( "Clear Two", command=lambda args: st.LogObjects().deleteObject("object_two", 2)) cmds.button("Object Three", command=lambda args: st.LogObjects().saveObject( "object_three", 3)) # 3 cmds.textField("object_three", en=False, text="None") cmds.button("Clear Three", command=lambda args: st.LogObjects().deleteObject( "object_three", 3)) cmds.rowColumnLayout(numberOfColumns=1, columnWidth=[(1, self.width - 10)], parent=frameLayoutStacking, co=[1, "both", 5]) cmds.text("StackSize") cmds.rowColumnLayout(numberOfColumns=3, columnWidth=[ (1, (self.width - 10) / 3.0), (2, (self.width - 10) / 3.0), (3, (self.width - 10) / 3.0), ], parent=frameLayoutStacking, co=[1, "both", 5]) cmds.radioCollection("size") cmds.radioButton("smallStack", label="Small") cmds.radioButton("mediumStack", label="Medium", sl=True) cmds.radioButton("largeStack", label="Large") cmds.rowColumnLayout(numberOfColumns=1, columnWidth=[(1, self.width - 10)], parent=frameLayoutStacking, co=[1, "both", 5]) cmds.text("Disorder") cmds.text("(least to most)") cmds.floatSlider("disorder", min=0, max=1, value=0.5) cmds.text("") cmds.button(label="Stack It!", h=30, command=lambda args: st.Stack().create()) # section four frameLayoutLeaning = cmds.frameLayout( width=self.width, label="Lean Against Wall", collapse=False, collapsable=True, marginHeight=10, marginWidth=5, parent=self.typeCol, ec=partial(frameCollapseChanged, str(self.col)), cc=partial(frameCollapseChanged, str(self.col))) cmds.rowColumnLayout(numberOfColumns=1, columnWidth=[(1, self.width - 10)], parent=frameLayoutLeaning, co=[1, "both", 5]) cmds.button(label="Load Object", h=30, command=lambda args: lw.LeanObject().loadInObject()) cmds.button(label="Wall", h=30, command=lambda args: lw.LeanObject().loadInWall()) cmds.button(label="Lean It", h=30, command=lambda args: lw.LeanObject().leanIt()) # section five frameLayoutRenamer = cmds.frameLayout( width=self.width, label="Renaming Objects", collapse=False, collapsable=True, marginHeight=10, marginWidth=5, parent=self.typeCol, ec=partial(frameCollapseChanged, str(self.col)), cc=partial(frameCollapseChanged, str(self.col))) cmds.rowColumnLayout(numberOfColumns=1, columnWidth=[(1, self.width - 10)], parent=frameLayoutRenamer, co=[1, "both", 5]) cmds.text("Prefix", align="center") cmds.radioCollection("prefix") cmds.radioButton("character", label="Character") cmds.radioButton("ui", label="UI") cmds.radioButton("staticMesh", label="Static Mesh", sl=True) cmds.radioButton("vehicle", label="Vehicle") cmds.radioButton("weapon", label="Weapon") cmds.text("", h=2) cmds.separator() cmds.text(" ", h=2) cmds.text("Object Name", h=20) cmds.text(" ", h=2) cmds.textField("baseName") cmds.rowColumnLayout(numberOfColumns=1, columnWidth=[(1, self.width - 10)], parent=frameLayoutRenamer, co=[1, "both", 5]) cmds.button(label="Rename Object", h=30, command=lambda args: rn.rename()) # put this at end winHeight = 0 for child in cmds.columnLayout(self.typeCol, q=1, ca=1): winHeight += eval('cmds.' + cmds.objectTypeUI(child) + '("' + child + '", q=1, h=1)') cmds.window(self.window, e=1, h=winHeight) cmds.showWindow(self.window)
if mode == _CLONE: doRefresh = cloneChannel(id) if mode == _CATEGORIES: categories() if mode == _EDITCHANNELS: editChannels() if mode == _CREATERENAME: dialog.ok('XML RENAMER FILE','This will create a file used for cleaning up channel names when creating your own XML files with mc2xml or zap2xml.','Please navigate to an XML file that you recently generated with one of these apps.') renamer.rename() if mode == _CREATEINI: dialog.ok('CREATE INI FILE','We will now load up the excellent Addons Ini Creator from [COLOR=dodgerblue]primaeval[/COLOR]. Using the subscribe option mark up the sections of add-ons you want scanned into your ini file. Once you\'re happy with your list choose the CREATE option.') xbmc.executebuiltin('ActivateWindow(10025,"plugin://plugin.video.addons.ini.creator",return)') if mode == _RENAMEART: dialog.ok('RENAME ART','Please navigate to the folder containing your artwork which requires renaming. The system will then loop through all the channel names and try to match up channel art with actual channel names.') rename_art() if mode == _ADDSKINSLIST: getSkinList(id)
if mode == _CLONE: doRefresh = cloneChannel(id) if mode == _CATEGORIES: categories() if mode == _EDITCHANNELS: editChannels() if mode == _CREATERENAME: dialog.ok( 'XML RENAMER FILE', 'This will create a file used for cleaning up channel names when creating your own XML files with mc2xml or zap2xml.', 'Please navigate to an XML file that you recently generated with one of these apps.' ) renamer.rename() if mode == _CREATEINI: dialog.ok( 'CREATE INI FILE', 'We will now load up the excellent Addons Ini Creator from [COLOR=dodgerblue]primaeval[/COLOR]. Using the subscribe option mark up the sections of add-ons you want scanned into your ini file. Once you\'re happy with your list choose the CREATE option.' ) xbmc.executebuiltin( 'ActivateWindow(10025,"plugin://plugin.video.addons.ini.creator",return)' ) if mode == _RENAMEART: dialog.ok( 'RENAME ART', 'Please navigate to the folder containing your artwork which requires renaming. The system will then loop through all the channel names and try to match up channel art with actual channel names.' )
room_is_telegram = True member_id = member.user_id # Check if the member is on a personal server personal_member = False for allowed_server in PERSONAL_SERVERS: if member_id.count(":") == 1 and member_id.endswith(":{}".format(allowed_server)): personal_member = True break if not personal_member: personal_member = member_id in PERSONAL_CONTACTS if VERBOSE: print(" {} {} {}".format("ok" if personal_member else "--", member_name, member_id)) room_is_personal = room_is_personal and personal_member # Now that we have classified the room, select name and avatar if room_is_telegram: new_name = TELEGRAM_DISPLAY_NAME new_avatar = TELEGRAM_AVATAR elif room_is_personal: new_name = PERSONAL_DISPLAY_NAME new_avatar = PERSONAL_AVATAR else: new_name = DEFAULT_DISPLAY_NAME new_avatar = DEFAULT_AVATAR return new_name, new_avatar strategy = SeppStrategy() passwd = getpass.getpass("Password: ") rename(strategy, MY_HOMESERVER, MY_MX_ID, passwd, SCRIPT_DEVICE_ID)