DS Audio 노래 가사 조회 플러그인

[펌] https://blog.acidpop.kr/308

해외, 국내 두개

DSM > ds audio > 설정 > 가사 플러그인 > 추가

알송 가사 플러그인 0.6

https://blog.kakaocdn.net/dn/ASGtY/btqz4KcjtQU/lxFGKo1s3j92kK2pcnyvaK/alsong_lyric_0.6.aum?attach=1&knm=tfile.aum

해외 가사 플러그인

https://github-releases.githubusercontent.com/203561885/715efe80-3661-11ea-9edf-e52c025dfe24?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20210609%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20210609T083249Z&X-Amz-Expires=300&X-Amz-Signature=e7dc3888ea45fef1a4b8c2e6a2e08ae85dcbe4bd2219d4b9f7e26d920f10cb0a&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=203561885&response-content-disposition=attachment%3B%20filename%3Dfujirou_musix_match-1.3.aum&response-content-type=application%2Foctet-stream




시놀로지 Audio Station에서 파일명으로 보는 방법

  • audio station 은 앨범별, 디스크, 트랙, 곡명으로 정렬, 재생된다. 이 경우, 멜론 등의 순위에 따른 재생이 어려워 진다.
  • 앨범명, 곡명을 변경하여 순위별 재생을 위해 아래의 작업을 진행한다.
  • 앨범명은 저장된 디렉토리명으로, 디스크는 1번으로 통일, 트랙은 곡명 소팅 순서로 변경한다.
  • 사전 준비사항
    • 패키지 센터에서 Python3 추가
    • PIP 설치
    • mutagen 설치 : python3 -m pip install mutagen
  • python 파일 작성 및 저장
import os
import sys
from mutagen.mp3 import EasyMP3
from mutagen.id3 import ID3, ID3NoHeaderError
import datetime

now = datetime.datetime.now()
print(now)

def changeMP3TagsInDir(dir):
    basename = os.path.basename(dir)
    changedCount = 0
    index = 1
    lst = sorted(os.listdir(dir))
    for file in lst:
        fullpath = os.path.join(dir, file)
        if os.path.isdir(fullpath):
            if file.lower().endswith("eadir"):
                continue
            changeMP3TagsInDir(fullpath)
        else:
            if file.lower().endswith(".mp3"):
                try:
                    tags = EasyMP3(fullpath)
                except ID3NoHeaderError:
                    tags = mutagen.File(fullpath, easy=True)
                    tags.add_tags(ID3=EasyID3)
                except UnicodeDecodeError:
                    pass

                if "album" in tags:
                    album = tags["album"][0]
                else:
                    album = ""

                index += 1

                # print("album = ", album, ", basename = ", basename)
                if album == basename:
                    continue

                tags["tracknumber"] = str(index)
                tags["discnumber"] = '1'
                tags["album"] = basename
                try:
                    tags.save()
                    changedCount += 1
                except:
                    print("could not save file "+file)

    print("MP3 tags change. dir=", dir, ", count=", changedCount)
    if changedCount > 0:
        # 색인 재설정
        # os.system("synoindex -R type_music &")
        # os.system("synoindex -A "+path+" &")
        os.system("synoindex -A '"+dir+"' &")

    return

if __name__ == "__main__":
    path = None
    if len(sys.argv) >= 2 and os.path.exists(sys.argv[1]):
        path = sys.argv[1]
    if path is not None and os.path.exists(path):
        changeMP3TagsInDir(path)
    else:
        print("Error: The path is incorrect (%s)" % path)
  • python 파일 배치 실행 등록
    • 실행명령어
      • export LANG=en_US.utf8
      • export PYTHONIOENCODING=UTF-8
      • python3 {python파일절대경로} “음악파일루트”
    • 제어판 > 작업 스케줄러 > 생성