File: tagger.py

package info (click to toggle)
picard 2.1.2-1%2Bdeb10u1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 15,860 kB
  • sloc: python: 40,588; sh: 119; ansic: 89; makefile: 13; xml: 8
file content (32 lines) | stat: -rwxr-xr-x 856 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/usr/bin/env python3

import os.path
import sys


# On Windows try to attach to the console as early as possible in order
# to get stdout / stderr logged to console. This needs to happen before
# logging gets imported.
# See https://stackoverflow.com/questions/54536/win32-gui-app-that-writes-usage-text-to-stdout-when-invoked-as-app-exe-help
if sys.platform == "win32":
    from ctypes import windll
    if windll.kernel32.AttachConsole(-1):
        sys.stdout = open('CON', 'w')
        sys.stderr = open('CON', 'w')


from picard.tagger import main
from picard.util import (
    frozen_temp_path,
    is_frozen,
)

sys.path.insert(0, '.')

# This is needed to find resources when using pyinstaller
if is_frozen:
    basedir = frozen_temp_path
else:
    basedir = os.path.dirname(os.path.abspath(__file__))

main(os.path.join(basedir, 'locale'), True)