Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: Jugran/lyrics-in-terminal
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 1.5.0
Choose a base ref
...
head repository: Jugran/lyrics-in-terminal
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: main
Choose a head ref

Commits on Mar 3, 2024

  1. Copy the full SHA
    5497733 View commit details
  2. Merge pull request #34 from Jugran/fix-user-agent-for-html-parsing

    fix user agent for google lyrics parsing
    Jugran authored Mar 3, 2024
    Copy the full SHA
    da73235 View commit details

Commits on Mar 4, 2024

  1. add genius lyrics source

    Jugran committed Mar 4, 2024
    Copy the full SHA
    419dce1 View commit details
  2. Copy the full SHA
    3d0a68b View commit details
  3. Merge pull request #35 from DmitrySandalov/main

    Fix issue: pass player name as an argument
    Jugran authored Mar 4, 2024
    Copy the full SHA
    fc424f1 View commit details
  4. Copy the full SHA
    389e4ad View commit details
  5. Merge pull request #36 from Jugran/fix/default-lyrics-command

    fix default lyrics command flow after #35
    Jugran authored Mar 4, 2024
    Copy the full SHA
    8231559 View commit details

Commits on May 27, 2024

  1. Find in lyrics percent statusbar (#1)

    Add lyrics search functionality and a track percentage status bar. Enables scrolling 100% to the bottom of the track so that search and manual scroll are compatible
    sirken authored May 27, 2024
    Copy the full SHA
    efa16d4 View commit details

Commits on Aug 20, 2024

  1. Merge pull request #39 from sirken/main

    Add the ability to search and find text in the current track
    Jugran authored Aug 20, 2024
    Copy the full SHA
    fb2b8ae View commit details
  2. Copy the full SHA
    80536d2 View commit details
  3. Merge pull request #41 from Jugran/development

    Development
    Jugran authored Aug 20, 2024
    Copy the full SHA
    d3b6a4e View commit details
  4. add source cycling

    Jugran committed Aug 20, 2024
    Copy the full SHA
    865134e View commit details
  5. remove deprecated config binds

    Jugran committed Aug 20, 2024
    Copy the full SHA
    a2ff8db View commit details
  6. Copy the full SHA
    76dba86 View commit details
  7. Merge branch 'development'

    Jugran committed Aug 20, 2024
    Copy the full SHA
    2415add View commit details
  8. release 1.6.0

    Jugran committed Aug 20, 2024
    Copy the full SHA
    446dc03 View commit details
  9. Copy the full SHA
    d7cda81 View commit details
  10. add debug launch.json

    Jugran committed Aug 20, 2024
    Copy the full SHA
    2c93a84 View commit details
  11. Copy the full SHA
    6724208 View commit details

Commits on Sep 9, 2024

  1. Merge pull request #43 from Jugran/feature/lyrics-provider

    Feature/lyrics provider
    Jugran authored Sep 9, 2024
    Copy the full SHA
    862c6a0 View commit details

Commits on Sep 15, 2024

  1. version 1.6.0

    Jugran committed Sep 15, 2024
    Copy the full SHA
    2310c8f View commit details
  2. Copy the full SHA
    48330cc View commit details
  3. Copy the full SHA
    8c48ece View commit details
  4. Merge pull request #44 from Jugran/development

    version 1.6.0
    Jugran authored Sep 15, 2024
    Copy the full SHA
    26e8a87 View commit details
Showing with 362 additions and 123 deletions.
  1. +16 −0 .vscode/launch.json
  2. +2 −2 lyrics/__init__.py
  3. +5 −3 lyrics/lyrics.cfg
  4. +7 −5 lyrics/lyrics_in_terminal.py
  5. +2 −5 lyrics/player.py
  6. +18 −5 lyrics/track.py
  7. +136 −79 lyrics/util.py
  8. +165 −15 lyrics/window.py
  9. +11 −9 setup.py
16 changes: 16 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Python: File",
"type": "debugpy",
"request": "launch",
"program": "${workspaceFolder}/lyrics/lyrics_in_terminal.py",
"console": "integratedTerminal",
"env": {
"PYTHONPATH": "${workspaceFolder}/lyrics:${PYTHONPATH}"
},
"justMyCode": true
},
]
}
4 changes: 2 additions & 2 deletions lyrics/__init__.py
Original file line number Diff line number Diff line change
@@ -2,9 +2,9 @@

CACHE_PATH = Path.home().joinpath('.cache', 'lyrics')

CONFIG_PATH = Path.home().joinpath('.config', 'lyrics-in-terminal','lyrics.cfg')
CONFIG_PATH = Path.home().joinpath('.config', 'lyrics-in-terminal', 'lyrics.cfg')

__version__ = '1.5.0'
__version__ = '1.7.0'

if not CONFIG_PATH.exists():
from shutil import copy
8 changes: 5 additions & 3 deletions lyrics/lyrics.cfg
Original file line number Diff line number Diff line change
@@ -11,6 +11,7 @@ mpd_port=6600
mpd_pass=
#colors
#offset=1
statusbar=on

[BINDINGS]
up=arrow_up
@@ -20,17 +21,18 @@ step-up=arrow_left
step-down=arrow_right
step-size=5

google=R
azLyrics=r

left=j
center=k
right=l

autoswitchtoggle=a
cycle-source=c

delete=d
edit=e
find=/
find-next=n
find-prev=p

help=h

12 changes: 7 additions & 5 deletions lyrics/lyrics_in_terminal.py
Original file line number Diff line number Diff line change
@@ -25,7 +25,7 @@ def wrapper(*args, **kwargs):


@ErrorHandler
def init_pager(stdscr):
def init_pager(stdscr=None):
defaults = Config('OPTIONS')

if len(sys.argv) >= 2:
@@ -47,7 +47,8 @@ def init_pager(stdscr):

interval = defaults['interval']
source = defaults['source']
mpd_connect = [defaults['mpd_host'], defaults['mpd_port'], defaults['mpd_pass']]
mpd_connect = [defaults['mpd_host'],
defaults['mpd_port'], defaults['mpd_pass']]

player = Player(player_name, source, autoswitch, mpd_connect, align=align)
win = Window(stdscr, player, timeout=interval)
@@ -69,15 +70,16 @@ def main():
from lyrics.track import Track

track = Track(artist=artist, title=title)
track.get_lyrics('google')
track.get_lyrics('any')

print(track.track_name)
print('-' * track.width, '\n')
print(track.get_text())

exit(0)
else:
init_pager()

init_pager()


if __name__ == "__main__":
main()
7 changes: 2 additions & 5 deletions lyrics/player.py
Original file line number Diff line number Diff line change
@@ -185,12 +185,9 @@ def update(self):

return False

def refresh(self, source=None, cache=True):
def refresh(self, cycle_source=False, source=None, cache=True):
''' Re-fetches lyrics from procided source
source -> source name ('google' or 'azlyrics')
cache -> bool | wether to store cache file
'''

if source is None:
source = self.default_source
self.track.get_lyrics(source, cache=cache)
self.track.get_lyrics(source, cycle_source, cache)
23 changes: 18 additions & 5 deletions lyrics/track.py
Original file line number Diff line number Diff line change
@@ -5,8 +5,8 @@

class Track:
def __init__(self,
artist=None,
title=None,
artist='',
title='',
align=1,
width=0):

@@ -15,9 +15,11 @@ def __init__(self,
self.alignment = align
self.width = width
self.length = 0
self.lyrics = None
self.lyrics = []
self.source = None
self.album = None
self.trackid = None
self.sources = ['google', 'azlyrics', 'genius']

def __str__(self):
''' trackname in format "{artist} - {title}"
@@ -57,10 +59,21 @@ def update(self, artist, title, album, trackid):
# self.art_url = art_url
# self.get_lyrics()

def get_lyrics(self, source, cache=True):
def get_lyrics(self, source, cycle_source=False, cache=True):
''' fetch lyrics off the internet
'''
self.lyrics = util.get_lyrics(self.track_name, source, cache=cache)
if self.source is None or self.source == 'cache':
self.source = source or self.sources[0]

if cycle_source:
curr_source = self.sources.index(self.source)
next_source = (curr_source + 1) % len(self.sources)
source = self.sources[next_source]
cache = False
else:
source = 'any'

self.lyrics, self.source = util.get_lyrics(self.track_name, source, cache=cache)
self.width = len(max(self.lyrics, key=len))
self.length = len(self.lyrics)

Loading