-
Notifications
You must be signed in to change notification settings - Fork 345
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
metadata/Music: adjust our lyrics *.py to use CU LRC unmodified
by moving our CLI from *.py to common/culrcwrap.py which uses tiny Kodistubs to let the few xbmc calls work. See README for simple upgrade procedure for any future CU LRC upgrades.
- Loading branch information
Showing
28 changed files
with
807 additions
and
2,888 deletions.
There are no files selected for viewing
8 changes: 8 additions & 0 deletions
8
mythtv/programs/scripts/metadata/Music/lyrics/Kodistubs/README
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
This is a tiny portion of Kodistubs to translate CU LRC to MythTV. | ||
|
||
If CU LRC ever refers to other functions, simply copy them in here | ||
from original Kodistubs and update as needed. | ||
|
||
-twitham@sbcglobal.net, 2024/01 for v34 | ||
|
||
source: https://github.com/romanvm/Kodistubs |
10 changes: 10 additions & 0 deletions
10
mythtv/programs/scripts/metadata/Music/lyrics/Kodistubs/xbmc.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Tiny portion of Kodistubs to translate CU LRC to MythTV. If CU LRC | ||
# ever refers to other functions, simply copy them in here from | ||
# original Kodistubs and update where needed like below. | ||
|
||
import sys | ||
|
||
LOGDEBUG = 0 | ||
|
||
def log(msg: str, level: int = LOGDEBUG) -> None: | ||
print(msg, file=sys.stderr) |
29 changes: 29 additions & 0 deletions
29
mythtv/programs/scripts/metadata/Music/lyrics/Kodistubs/xbmcaddon.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Tiny portion of Kodistubs to translate CU LRC to MythTV. If CU LRC | ||
# ever refers to other functions, simply copy them in here from | ||
# original Kodistubs and update where needed like below. | ||
|
||
from typing import Optional | ||
|
||
class Addon: | ||
|
||
def __init__(self, id: Optional[str] = None) -> None: | ||
pass | ||
|
||
def getLocalizedString(self, id: int) -> str: | ||
# only testall.py / scrapertest.py needs only 1 message from | ||
# resources/language/resource.language.en_us/strings.po | ||
if (id == 32163): | ||
return "Testing: %s" | ||
return "(%s)" % id | ||
|
||
def getSettingBool(self, id: str) -> bool: | ||
return True | ||
|
||
def getSettingInt(self, id: str) -> int: | ||
return 0 | ||
|
||
def getSettingString(self, id: str) -> str: | ||
return "" | ||
|
||
def getAddonInfo(self, id: str) -> str: | ||
return "" |
38 changes: 38 additions & 0 deletions
38
mythtv/programs/scripts/metadata/Music/lyrics/Kodistubs/xbmcgui.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# Tiny portion of Kodistubs to translate CU LRC to MythTV. If CU LRC | ||
# ever refers to other functions, simply copy them in here from | ||
# original Kodistubs and update where needed like below. | ||
|
||
# show "dialog" on stderr for testall.py / scrapertest.py | ||
import sys | ||
|
||
class Dialog: | ||
|
||
def __init__(self) -> None: | ||
pass | ||
|
||
def ok(self, heading: str, message: str) -> bool: | ||
return True | ||
|
||
class DialogProgress: | ||
|
||
def __init__(self) -> None: | ||
pass | ||
|
||
def create(self, heading: str, message: str = "") -> None: | ||
print("\tDIALOG created: ", heading, " : ", message, file=sys.stderr) | ||
pass | ||
|
||
def update(self, percent: int, message: str = "") -> None: | ||
print("\tDIALOG updated %s: " % percent, message, file=sys.stderr) | ||
pass | ||
|
||
def close(self) -> None: | ||
pass | ||
|
||
def iscanceled(self) -> bool: | ||
# not cancelled is needed to continue the testall.py / scrapertest.py | ||
return False | ||
|
||
class Window: | ||
def __init__(self, existingWindowId: int = -1) -> None: | ||
pass |
56 changes: 56 additions & 0 deletions
56
mythtv/programs/scripts/metadata/Music/lyrics/Kodistubs/xbmcvfs.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# Tiny portion of Kodistubs to translate CU LRC to MythTV. If CU LRC | ||
# ever refers to other functions, simply copy them in here from | ||
# original Kodistubs and update where needed like below. | ||
|
||
from typing import Union, Optional | ||
import os.path | ||
|
||
# embedlrc.py and musixmatchlrc.py need some File access | ||
|
||
class File: | ||
|
||
def __init__(self, filepath: str, mode: Optional[str] = None) -> None: | ||
self.filename = filepath | ||
if mode: | ||
self.fh = open(filepath, mode) | ||
else: | ||
self.fh = open(filepath, "rb") | ||
|
||
def __enter__(self) -> 'File': # Required for context manager | ||
return self | ||
|
||
def __exit__(self, exc_type, exc_val, exc_tb): # Required for context manager | ||
pass | ||
|
||
def read(self, numBytes: int = 0) -> str: | ||
if numBytes: | ||
return self.fh.read(numBytes) | ||
return self.fh.read() | ||
|
||
def readBytes(self, numBytes: int = 0) -> bytearray: | ||
if numBytes: | ||
return bytearray(self.fh.read(numBytes)) | ||
return bytearray(self.fh.read()) | ||
|
||
def write(self, buffer: Union[str, bytes, bytearray]) -> bool: | ||
return self.fh.write(buffer) | ||
|
||
def size(self) -> int: | ||
return 0 | ||
|
||
def seek(self, seekBytes: int, iWhence: int = 0) -> int: | ||
return self.fh.seek(seekBytes, iWhence); | ||
|
||
def tell(self) -> int: | ||
return self.fh.tell() | ||
|
||
def close(self) -> None: | ||
self.fh.close() | ||
pass | ||
|
||
def exists(path: str) -> bool: | ||
# for musixmatchlrc.py the test must work or return False | ||
return os.path.isfile(path) | ||
|
||
def translatePath(path: str) -> str: | ||
return "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.