Tag the file at podpath with the information in podcast and entry
484397
def tag(placeholders):
    
    # We first recover the name of the file to be tagged...
    template = placeholders.feed.retrieve_config("file_to_tag", "{filename}")
    filename = substitute_placeholders(template, placeholders)
    podpath = os.path.join(placeholders.directory, filename)
    # ... and this is it

    # now we create a dictionary of tags and values
    tagdict = placeholders.feed.defaulttagdict  # these are the defaults
    try:  # We do as if there was a section with potential tag info
        feedoptions = placeholders.feed.config.options(placeholders.name)
        # this monstruous concatenation of classes... surely a bad idea.
        tags = [[option.replace("tag_", ""), placeholders.feed.config[
            placeholders.name][option]] for option in feedoptions if "tag_" in
                option]  # these are the tags to be filled
        if tags:
            for tag in tags:
                tagdict[tag[0]] = tag[1]
    except configparser.NoSectionError:
        pass
    for tag in tagdict:
        metadata = substitute_placeholders(
            tagdict[tag], placeholders)
        if metadata:
            stagger.util.set_frames(podpath, {tag: metadata})
        else:
            stagger.util.remove_frames(podpath, tag)
146755
void addPod(PodBuilderConfig pod)
  {
    String podName = pod.getId() + "." + pod.getCluster().id();
    
    if (_podMap.get(podName) != null) {
      throw new IllegalStateException(L.l("Duplicate pod '{0}'", pod.getId()));
    }
    
    _podMap.put(podName, pod);
  }
803969
def tag_path(cls, project, incident, tag):
        """"""
        return google.api_core.path_template.expand(
            "projects/{project}/incidents/{incident}/tags/{tag}",
            project=project,
            incident=incident,
            tag=tag,
        )
730590
def tag_stuff(self):
        """"""

        # For each packet in the pcap process the contents
        for item in self.input_stream:

            # Make sure it has a tags field (which is a set)
            if 'tags' not in item:
                item['tags'] = set()

            # For each tag_methods run it on the item
            for tag_method in self.tag_methods:
                item['tags'].add(tag_method(item))

            # Not interested in None tags
            if None in item['tags']:
                item['tags'].remove(None)
            # All done
            yield item
514372
def add_details(file_name, title, artist, album, lyrics=""):
    '''
    
    '''

    tags = EasyMP3(file_name)
    tags["title"] = title
    tags["artist"] = artist
    tags["album"] = album
    tags.save()

    tags = ID3(file_name)
    uslt_output = USLT(encoding=3, lang=u'eng', desc=u'desc', text=lyrics)
    tags["USLT::'eng'"] = uslt_output

    tags.save(file_name)

    log.log("> Adding properties")
    log.log_indented("[*] Title: %s" % title)
    log.log_indented("[*] Artist: %s" % artist)
    log.log_indented("[*] Album: %s " % album)
735449
public File newStagingFile(String entryName, long modTime) {
        File file = new File(stagingDirectory, entryName);
        
        if (modTime != 0) {
            file.setLastModified(modTime);
        }
        
        file.getParentFile().mkdirs();
        return file;
    }
326980
def __write_add_tmpl(tag_key, tag_list):
    '''
    
    '''
    add_file = os.path.join(OUT_DIR, 'add', 'add_' + tag_key.split('_')[1] + '.html')
    add_widget_arr = []
    # var_dic = eval('dic_vars.' + bianliang)
    for sig in tag_list:
        html_sig = '_'.join(['html', sig])
        # var_html = eval('html_vars.' + html_sig)
        var_html = HTML_DICS[html_sig]

        if var_html['type'] in INPUT_ARR:
            tmpl = func_gen_html.gen_input_add(var_html)
        elif var_html['type'] == 'select':
            tmpl = func_gen_html.gen_select_add(var_html)
        elif var_html['type'] == 'radio':
            tmpl = func_gen_html.gen_radio_add(var_html)
        elif var_html['type'] == 'checkbox':
            tmpl = func_gen_html.gen_checkbox_add(var_html)
        elif var_html['type'] == 'file':
            tmpl = func_gen_html.gen_file_add(var_html)
        else:
            tmpl = ''
        add_widget_arr.append(tmpl)
    with open(add_file, 'w') as fileout:
        outstr = minify(
            TPL_ADD.replace(
                'xxxxxx',
                ''.join(add_widget_arr)
            ).replace(
                'yyyyyy',
                tag_key.split('_')[1][:2]
            ).replace(
                'kkkk',
                KIND_DICS['kind_' + tag_key.split('_')[-1]]
            )
        )
        fileout.write(outstr)
654295
def add_tagfile(self, path, timestamp=None):
        # type: (Text, datetime.datetime) -> None
        """"""
        self.self_check()
        checksums = {}
        # Read file to calculate its checksum
        if os.path.isdir(path):
            return
            # FIXME: do the right thing for directories
        with open(path, "rb") as tag_file:
            # FIXME: Should have more efficient open_tagfile() that
            # does all checksums in one go while writing through,
            # adding checksums after closing.
            # Below probably OK for now as metadata files
            # are not too large..?

            checksums[SHA1] = checksum_copy(tag_file, hasher=hashlib.sha1)

            tag_file.seek(0)
            checksums[SHA256] = checksum_copy(tag_file, hasher=hashlib.sha256)

            tag_file.seek(0)
            checksums[SHA512] = checksum_copy(tag_file, hasher=hashlib.sha512)

        rel_path = _posix_path(os.path.relpath(path, self.folder))
        self.tagfiles.add(rel_path)
        self.add_to_manifest(rel_path, checksums)
        if timestamp is not None:
            self._file_provenance[rel_path] = {"createdOn": timestamp.isoformat()}
1201136
def tag_audio_file(audio_file, tracklisting):
    
    try:
        save_tag_to_audio_file(audio_file, tracklisting)
    # TODO: is IOError required now or would the mediafile exception cover it?
    except (IOError, mediafile.UnreadableFileError):
        print("Unable to save tag to file:", audio_file)
        audio_tagging_successful = False
    except TagNotNeededError:
        audio_tagging_successful = True
    else:
        audio_tagging_successful = True
    return audio_tagging_successful
125888
function tag (msg, done) {
    var clean_data = {
      source: 'demo-plugin',
      payload: msg.payload
    }

    done(null, clean_data)
  }
484051
def PrintTags(self, file):
        """"""
        print >>file, '/* Tag definition for %s */' % self._name
        print >>file, 'enum %s_ {' % self._name.lower()
        for entry in self._entries:
            print >>file, '  %s=%d,' % (self.EntryTagName(entry),
                                        entry.Tag())
        print >>file, '  %s_MAX_TAGS' % (self._name.upper())
        print >>file, '};\n'
1110381
private void pushTag(String qName) {
		final String currentTag = getCurrentTag();
		if ("".equals(currentTag)) {
			mTagStack.push(qName);
		} else {
			mTagStack.push(getCurrentTag() + "." + qName);
		}
	}
708408
def tag(self, path, name):
    '''
      
    '''

    if not path[len(path) - 1] == '/':
      path += '/'

    config = self.get_config()
    folder = self.find_folder({
      'path' : path
    }, config)

    if not folder:
      raise custom_errors.FileNotInConfig(path)

    old_name = folder['label']
    folder['label'] = name
    
    dir_config = self.adapter.get_dir_config(path)
    dir_config['label'] = name
    self.adapter.set_dir_config(dir_config)

    self.set_config(config)
    # self.restart

    return old_name
192521
def stream_hashtag(self, tag, listener, run_async=False, timeout=__DEFAULT_STREAM_TIMEOUT, reconnect_async=False, reconnect_async_wait_sec=__DEFAULT_STREAM_RECONNECT_WAIT_SEC):
        
        if tag.startswith("#"):
            raise MastodonIllegalArgumentError("Tag parameter should omit leading #")
        return self.__stream("/api/v1/streaming/hashtag?tag={}".format(tag), listener, run_async=run_async, timeout=timeout, reconnect_async=reconnect_async, reconnect_async_wait_sec=reconnect_async_wait_sec)
458584
def linktag(self, url, path, filename, media, context):
        
        if msettings['DOCTYPE'] == 'xhtml':
            markup = """<link rel="stylesheet" href="%s" type="text/css" media="%s" />"""
        elif msettings['DOCTYPE'] == 'html5':
            markup = """<link rel="stylesheet" href="%s" media="%s">"""
        else:
            markup = """<link rel="stylesheet" href="%s" type="text/css" media="%s">"""
        return markup % (self.mkpath(url, path, filename, gzip=self.supports_gzip(context)), media)
98886
def has_loudness_tag(filepath):
  
  track, album = False, False

  try:
    mf = mutagen.File(filepath)
  except mutagen.MutagenError as e:
    logger().warning("File '%s' %s: %s" % (filepath,
                                           e.__class__.__qualname__,
                                           e))
    return

  if (isinstance(mf.tags, mutagen.id3.ID3) or
          isinstance(mf, mutagen.id3.ID3FileType)):
    track = ("TXXX:REPLAYGAIN_TRACK_GAIN" in mf) and ("TXXX:REPLAYGAIN_TRACK_PEAK" in mf)
    album = ("TXXX:REPLAYGAIN_ALBUM_GAIN" in mf) and ("TXXX:REPLAYGAIN_ALBUM_PEAK" in mf)

  elif isinstance(mf, mutagen.oggopus.OggOpus):
    track = "R128_TRACK_GAIN" in mf
    album = "R128_ALBUM_GAIN" in mf

  elif (isinstance(mf.tags, (mutagen._vorbis.VComment, mutagen.apev2.APEv2)) or
        isinstance(mf, (mutagen.ogg.OggFileType, mutagen.apev2.APEv2File))):
    track = ("REPLAYGAIN_TRACK_GAIN" in mf) and ("REPLAYGAIN_TRACK_PEAK" in mf)
    album = ("REPLAYGAIN_ALBUM_GAIN" in mf) and ("REPLAYGAIN_ALBUM_PEAK" in mf)

  elif (isinstance(mf.tags, mutagen.mp4.MP4Tags) or
        isinstance(mf, mutagen.mp4.MP4)):
    track = ("----:COM.APPLE.ITUNES:REPLAYGAIN_TRACK_GAIN" in mf) and ("----:COM.APPLE.ITUNES:REPLAYGAIN_TRACK_PEAK" in mf)
    album = ("----:COM.APPLE.ITUNES:REPLAYGAIN_ALBUM_GAIN" in mf) and ("----:COM.APPLE.ITUNES:REPLAYGAIN_ALBUM_PEAK" in mf)

  else:
    logger().warning("Unhandled '%s' tag format for file '%s'" % (mf.__class__.__name__,
                                                                  filepath))
    return

  return track, album
1122462
def parse_podcast(url):
    
    try:
        podcast = feedparser.parse(url)
        wentwrong = "urlopen" in str(podcast["bozo_exception"])
    except KeyError:
        wentwrong = False
    if wentwrong:
        print("Error: ", url, ": ", str(podcast["bozo_exception"]))
    return podcast