Save songs to files
777853
def saveFiles(fileName1, fileName2, songs, artist, album, trackNum):
    """"""
    songs[0].export(fileName1, format=detectFormat(fileName1), tags={'artist': artist, 'album': album, 'track': trackNum})
    songs[1].export(fileName2, format=detectFormat(fileName2), tags={'artist': artist, 'album': album, 'track': str(int(trackNum) + 1)})
1129974
def save(self, filename):
        ''' 
        '''
        with open(filename, 'w') as outfile:
            json.dump(self.to_json(), outfile)
1008859
def save_to_file(self, text, filename, name):
        '''
        
        '''
        self._push(self._driver.save_to_file, (text, filename), name)
912768
def download_song(song_url, song_title):
    

    outtmpl = song_title + '.%(ext)s'
    ydl_opts = {
        'format': 'bestaudio/best',
        'outtmpl': outtmpl,
        'postprocessors': [
            {'key': 'FFmpegExtractAudio','preferredcodec': 'mp3',
             'preferredquality': '192',
            },
            {'key': 'FFmpegMetadata'},
        ],
    }

    with youtube_dl.YoutubeDL(ydl_opts) as ydl:
        info_dict = ydl.extract_info(song_url, download=True)
180526
def save_lyrics(self, extension='json', overwrite=False,
                    verbose=True, binary_encoding=False):
        """"""
        extension = extension.lstrip(".")
        assert (extension == 'json') or (extension == 'txt'), "format_ must be JSON or TXT"

        for song in self.songs:
            song.save_lyrics(extension=extension, overwrite=overwrite, verbose=verbose, binary_encoding=binary_encoding)
84313
def save_fileAs(self, file=None):
        

        file = file or umbra.ui.common.store_last_browsed_path(
            QFileDialog.getSaveFileName(self, "Save As:", self.__file))
        if not file:
            return False

        return self.write_file(foundations.strings.to_string(file))
323125
def save_to_file fn, talk=true
    FileUtils.mkdir_p File.dirname(fn)
    if File.exist? fn
      unless BufferManager.ask_yes_or_no "File \"#{fn}\" exists. Overwrite?"
        info "Not overwriting #{fn}"
        return
      end
    end
    begin
      File.open(fn, "w") { |f| yield f }
      BufferManager.flash "Successfully wrote #{fn}." if talk
      true
    rescue SystemCallError, IOError => e
      m = "Error writing file: #{e.message}"
      info m
      BufferManager.flash m
      false
    end
  end
177980
def save(self, outfile):
        """"""
        if isinstance(outfile, compat.string_type):
            outfile = open(outfile, 'wb')
        outfile.write(compat.urllib2.urlopen(self.href).read())
675782
def fix_music(file_name):
    '''
    
    '''

    setup()

    if not Py3:
        file_name = file_name.encode('utf-8')

    tags = File(file_name)

    log.log(file_name)
    log.log('> Adding metadata')

    try:
        artist, album, song_name, lyrics, match_bool, score = get_details_spotify(
            file_name)  # Try finding details through spotify

    except Exception:
        artist, album, song_name, lyrics, match_bool, score = get_details_letssingit(
            file_name)  # Use bad scraping method as last resort

    try:
        log.log_indented('* Trying to extract album art from Google.com')
        albumart = albumsearch.img_search_google(artist+' '+album)
    except Exception:
        log.log_indented('* Trying to extract album art from Bing.com')
        albumart = albumsearch.img_search_bing(artist+' '+album)

    if match_bool:
        add_albumart(albumart, file_name)
        add_details(file_name, song_name, artist, album, lyrics)

        try:
            rename(file_name, artist+' - '+song_name+'.mp3')
        except Exception:
            log.log_error("Couldn't rename file")
            pass
    else:
        log.log_error(
            "* Couldn't find appropriate details of your song", indented=True)

    log.log("Match score: %s/10.0" % round(score * 10, 1))
    log.log(LOG_LINE_SEPERATOR)
    log.log_success()
318166
def save_file(self, filename, text):
        """"""
        if not filename.endswith('.py'):
            filename += '.py'
        path = os.path.join(self.currentpath, filename)
        with open(path, 'w', encoding="utf-8") as file_:
            file_.write(text)
489737
public function save()
	{
		if (self::$file_added)
			file_put_contents($this->getFileListName(), '<?php return ' . var_export(self::$files[$this->prefix], true) . ';');

		self::$file_added = false;
	}
857531
def download_song_by_id(self, song_id, song_name, folder='.'):
        

        try:
            url = self.crawler.get_song_url(song_id)
            if self.lyric:
                # use old api
                lyric_info = self.crawler.get_song_lyric(song_id)
            else:
                lyric_info = None
            song_name = song_name.replace('/', '')
            song_name = song_name.replace('.', '')
            self.crawler.get_song_by_url(url, song_name, folder, lyric_info)
        except RequestException as exception:
            click.echo(exception)
873155
def save_tag_to_audio_file(audio_file, tracklisting):
    
    print("Trying to tag {}".format(audio_file))
    f = mediafile.MediaFile(audio_file)

    if not f.lyrics:
        print("No tracklisting present. Creating lyrics tag.")
        f.lyrics = 'Tracklisting' + '\n' + tracklisting
    elif tracklisting not in f.lyrics:
        print("Appending tracklisting to existing lyrics tag.")
        f.lyrics = f.lyrics + '\n\n' + 'Tracklisting' + '\n' + tracklisting
    else:
        print("Tracklisting already present. Not modifying file.")
        raise TagNotNeededError

    f.save()
    print("Saved tag to file:", audio_file)
790139
def download(self, song):
		

		song_id = song['id']

		response = self._call(
			mm_calls.Export,
			self.uploader_id,
			song_id)
		audio = response.body
		suggested_filename = unquote(
			response.headers['Content-Disposition'].split("filename*=UTF-8''")[-1]
		)

		return (audio, suggested_filename)
1243383
def save fname, options={}
      File.open(fname,"wb"){ |f| f << export(options) }
    end
971615
def song(netease, name, id):
    """"""
    if name:
        netease.download_song_by_search(name)

    if id:
        netease.download_song_by_id(id, 'song'+str(id))
477187
function saveFile() {
      if (currentFile) {
        if (!currentFile.oldName) {
          currentFile.oldName = possibleOldName;
        }

        if (!currentFile.newName) {
          currentFile.newName = possibleNewName;
        }

        if (currentFile.newName) {
          files.push(currentFile);
          currentFile = null;
        }
      }

      possibleOldName = undefined;
      possibleNewName = undefined;
    }