# ... well, it's complicated. Especially if values of the dict could # possibly look like "Well, you know, there's this guy who said "Flubbsy" # all the time!" # With commas, single quotes, double quotes, who knows. # So here's a quick hack to try to enable this. It works, but only if the # user doesn't make mistakes. # An empty dict epi_dict = {} # Split to a list containing the key-value pairs pairs = args.epi_dict.split(',') ## Iterate the list and split those into a list of two separate strings for pair in pairs: sepstr = pair.split(':') # Now, any quotes, double quotes and spaces that are at the # beginning or and of these strings need to be removed. sepstr[0] = sepstr[0].strip() sepstr[0] = sepstr[0].strip('\'') sepstr[1] = sepstr[1].strip() sepstr[1] = sepstr[1].strip('\'') epi_dict[sepstr[0]] = sepstr[1] else: epi_dict = None # Start the Fism! fism.start(args.slug, args.audio, args.title, args.track, args.subtitle, args.summary, args.post, args.tags, args.chapters, epi_dict, args.prep_epi)
""" Data needed for the Firtz """ self.prep_epi = raw_input('Specify relative or absolute path to a prepared \ *.epi file, e.g. "prep/spc001-crazy-title.epi" or \ "/home/user/prep/spc001-crazy-title.epi". (Default: None): ') or None self.epi_dict = {} while raw_input('Do you want to specify a(nother) key-value pair for the \ epi file? E.g. "date: 1945-05-23 23:05:23" yn (Default:n): \ ') == ("y" or "Y" or "yes" or "Yes"): key = raw_input('Specify key, e.g. "date": ') value = raw_input('Specify value, e.g. "1945-05-23 23:05:23": ') self.epi_dict[key] = value def ask_adn(self): """ Data needed for ADN """ self.post = raw_input('Write your post text. (Max 256 characters): ') if __name__ == "__main__": ia = Interactive() ia.ask() # Init the Fism with the settings fism = Fism((ia.settings or 'settings.json')) # Start the Fism! fism.start(ia.slug, ia.audio, ia.title, ia.track, ia.subtitle, ia.summary, ia.post, ia.tags, ia.chapters, ia.epi_dict, ia.prep_epi)