abhimanyuPathania / lyrico

A python based command-line lyrics downloader
https://pypi.python.org/pypi/lyrico
Other
15 stars 6 forks source link

When recursing, how to save lyrics file next to mp3? #18

Open reagle opened 5 years ago

reagle commented 5 years ago

This looks like a nice tool, but I find the requirement to set options before hand odd. Additionally, I can't figure out how to keep the lyrics files next to the mp3s, as plex requires.

cweiske commented 5 years ago

My fork improves the configuration situation considerably - https://github.com/cweiske/lyrico

The plex option is a duplicate of #17.

reagle commented 5 years ago

Thanks @cweiske, but pycodestyle throws lots of errors and the program faults:

...
  File "/usr/local/lib/python3.7/site-packages/lyrico/lyrico_sources/az_lyrics.py", line 115
    lyrics = lyric_tag.get_text().strip()
                                        ^
TabError: inconsistent use of tabs and spaces in indentation

@abhimanyuPathania are you still maintaining this or accepting PRs?

cweiske commented 5 years ago

Oh. I still use python 2 to run it and never saw this errors.

cweiske commented 5 years ago

python3 tab errors fixed.

cweiske commented 5 years ago

I have some PRs open since over 2 years. I don't think this repository is maintained anymore.

reagle commented 5 years ago

@cweiske, I have it working with python2, but it's the same old behavior: I have to preconfigure actions instead of just using command line options. Also, how do you specify the "plex option"?

cweiske commented 5 years ago

You do not have to configure the music dir anymore. All other options still need to be configured, that's true.

There is no plex option yet. "save_to_file" will save it to the lyrics directory. I wrote that your request for a plex option is the same as issue #17.

reagle commented 5 years ago

I added a kludge in song.py for the time being to place the txt file next to the mp3. If the lyrics_dir has been set as '.', then change self.lyrics_file_path.

Because it's a kludge at the point of writing the file, it's dumb about not knowing if a search or the file has already been done.

    def save_lyrics(self):

        """
            Called by self.download_lyrics to save lyrics according to
            Config.save_to_file, Config.save_to_tag settings.

            Handles the case if lyrics is not found. Logs errors to console
            and Song object.

        """

        if not self.lyrics:
            Song.lyrics_errors_count += 1
            print('Failed:', self.error)
            return

        if self.lyrics and Config.save_to_file:
            try:
                if self.path.startswith('./'):
                    self.lyrics_file_path = os.path.splitext(self.path)[0] + '.txt'
...
schellenberg commented 5 years ago

How about this -- check if lyrics_dir has been set as PLEX-MODE inside song_helper.py (in the get_song_data(path) function. Then, use the naming convention required by Plex (exact same filename, but with the .txt extension) to save the file.

Around line 211...


    # If tag is not read or either of artist name or title is not preset
    # those properties of the Song object would be intialized to None
    if artist and title:
        if Config.lyrics_dir == "PLEX-MODE":
            song_name, song_extension = os.path.splitext(path)
            lyrics_file_name = song_name + ".txt"
            lyrics_file_path = os.path.join(os.path.dirname(path), lyrics_file_name)

        else:
            lyrics_file_name = '%s - %s.txt' % (artist, title)
            lyrics_file_path = os.path.join(Config.lyrics_dir, lyrics_file_name)
    else:
        # Only log the following error if the tags have been read correctly but
        # artist or title was simply not present in the tag.
        # Else the pre-existing error due to reading of tags should be logged
        if not error:
            error = 'Artist name or song title not found.'```
abhimanyuPathania commented 5 years ago

@reagle I'm not maintaining this anymore. Got bogged down with work and life. @cweiske fork looks good and is being updated. Please use that.

reagle commented 5 years ago

@abhimanyuPathania, thanks for responding. If @cweiske takes it over, would you facilitate the transfer on pip? That's how I installed it.

Jabster28 commented 3 years ago

@abhimanyuPathania, thanks for responding. If @cweiske takes it over, would you facilitate the transfer on pip? That's how I installed it.

+1, @abhimanyuPathania if you're not maintaining this, could you archive it and point users to the fork?