Multilingualized
Now there're English, Russian and Japanese languages
This commit is contained in:
parent
5a622f53cd
commit
fe7d0c178a
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,3 +1,4 @@
|
|||||||
__pycache__
|
__pycache__
|
||||||
build*
|
build*
|
||||||
*.spec
|
*.spec
|
||||||
|
/config.json
|
||||||
@ -47,15 +47,15 @@
|
|||||||
</property>
|
</property>
|
||||||
<property name="font">
|
<property name="font">
|
||||||
<font>
|
<font>
|
||||||
<family>Century Gothic</family>
|
<family>Comic Sans MS</family>
|
||||||
<pointsize>20</pointsize>
|
<pointsize>22</pointsize>
|
||||||
</font>
|
</font>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Newgrounds Audio Downloader by H1K0</string>
|
<string><strong>Newgrounds Audio Downloader</strong> by <em>H1K0</em></string>
|
||||||
</property>
|
</property>
|
||||||
<property name="alignment">
|
<property name="alignment">
|
||||||
<set>Qt::AlignCenter</set>
|
<set>Qt::AlignBottom|Qt::AlignHCenter</set>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QLineEdit" name="input">
|
<widget class="QLineEdit" name="input">
|
||||||
@ -69,7 +69,7 @@
|
|||||||
</property>
|
</property>
|
||||||
<property name="font">
|
<property name="font">
|
||||||
<font>
|
<font>
|
||||||
<family>Courier New</family>
|
<family>Maiandra GD</family>
|
||||||
<pointsize>12</pointsize>
|
<pointsize>12</pointsize>
|
||||||
</font>
|
</font>
|
||||||
</property>
|
</property>
|
||||||
@ -83,7 +83,7 @@
|
|||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QPushButton" name="dlbtn">
|
<widget class="QPushButton" name="btn">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>20</x>
|
<x>20</x>
|
||||||
@ -101,11 +101,14 @@
|
|||||||
<property name="cursor">
|
<property name="cursor">
|
||||||
<cursorShape>PointingHandCursor</cursorShape>
|
<cursorShape>PointingHandCursor</cursorShape>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>(Enter)</string>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Download!</string>
|
<string>Download!</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="shortcut">
|
<property name="shortcut">
|
||||||
<string>Return</string>
|
<string>Ctrl+S</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
@ -115,9 +118,33 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>600</width>
|
<width>600</width>
|
||||||
<height>21</height>
|
<height>23</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<family>Century Gothic</family>
|
||||||
|
<pointsize>10</pointsize>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<widget class="QMenu" name="menu">
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<family>Century Gothic</family>
|
||||||
|
<pointsize>9</pointsize>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="cursor">
|
||||||
|
<cursorShape>ArrowCursor</cursorShape>
|
||||||
|
</property>
|
||||||
|
<property name="title">
|
||||||
|
<string>MENU</string>
|
||||||
|
</property>
|
||||||
|
<addaction name="actionSettings"/>
|
||||||
|
<addaction name="separator"/>
|
||||||
|
<addaction name="actionHelp"/>
|
||||||
|
</widget>
|
||||||
|
<addaction name="menu"/>
|
||||||
</widget>
|
</widget>
|
||||||
<action name="settings">
|
<action name="settings">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
@ -135,6 +162,36 @@
|
|||||||
<string>F1</string>
|
<string>F1</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
|
<action name="actionSettings">
|
||||||
|
<property name="icon">
|
||||||
|
<iconset>
|
||||||
|
<normaloff>../settings.ico</normaloff>../settings.ico</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Settings</string>
|
||||||
|
</property>
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<family>Century Gothic</family>
|
||||||
|
<pointsize>10</pointsize>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="shortcut">
|
||||||
|
<string>Alt+S</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="actionHelp">
|
||||||
|
<property name="icon">
|
||||||
|
<iconset>
|
||||||
|
<normaloff>../help.ico</normaloff>../help.ico</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Help</string>
|
||||||
|
</property>
|
||||||
|
<property name="shortcut">
|
||||||
|
<string>F1</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
</widget>
|
</widget>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections/>
|
<connections/>
|
||||||
|
|||||||
@ -10,6 +10,24 @@
|
|||||||
<height>150</height>
|
<height>150</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>400</width>
|
||||||
|
<height>150</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>400</width>
|
||||||
|
<height>150</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>ACHTUNG!</string>
|
<string>ACHTUNG!</string>
|
||||||
</property>
|
</property>
|
||||||
@ -28,12 +46,12 @@
|
|||||||
</property>
|
</property>
|
||||||
<property name="font">
|
<property name="font">
|
||||||
<font>
|
<font>
|
||||||
<family>Century Gothic</family>
|
<family>Maiandra GD</family>
|
||||||
<pointsize>16</pointsize>
|
<pointsize>16</pointsize>
|
||||||
</font>
|
</font>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>TextLabel</string>
|
<string>ACHTUNG!</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="alignment">
|
<property name="alignment">
|
||||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||||
|
|||||||
@ -39,20 +39,23 @@
|
|||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>20</x>
|
<x>20</x>
|
||||||
<y>30</y>
|
<y>20</y>
|
||||||
<width>451</width>
|
<width>451</width>
|
||||||
<height>21</height>
|
<height>31</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="font">
|
<property name="font">
|
||||||
<font>
|
<font>
|
||||||
<family>Courier New</family>
|
<family>Maiandra GD</family>
|
||||||
<pointsize>14</pointsize>
|
<pointsize>14</pointsize>
|
||||||
</font>
|
</font>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Downloading...</string>
|
<string>Downloading...</string>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft</set>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QProgressBar" name="bar">
|
<widget class="QProgressBar" name="bar">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
@ -70,7 +73,7 @@
|
|||||||
<number>100</number>
|
<number>100</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="value">
|
<property name="value">
|
||||||
<number>0</number>
|
<number>54</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="textVisible">
|
<property name="textVisible">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
|
|||||||
230
GUI/SettingsDialog.ui
Normal file
230
GUI/SettingsDialog.ui
Normal file
@ -0,0 +1,230 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>Dialog</class>
|
||||||
|
<widget class="QDialog" name="Dialog">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>400</width>
|
||||||
|
<height>240</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>400</width>
|
||||||
|
<height>240</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>400</width>
|
||||||
|
<height>240</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Settings</string>
|
||||||
|
</property>
|
||||||
|
<property name="windowIcon">
|
||||||
|
<iconset>
|
||||||
|
<normaloff>../settings.ico</normaloff>../settings.ico</iconset>
|
||||||
|
</property>
|
||||||
|
<widget class="QDialogButtonBox" name="btnx">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>30</x>
|
||||||
|
<y>190</y>
|
||||||
|
<width>341</width>
|
||||||
|
<height>32</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<family>Cooper Black</family>
|
||||||
|
<pointsize>14</pointsize>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="standardButtons">
|
||||||
|
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QLabel" name="title">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>20</x>
|
||||||
|
<y>20</y>
|
||||||
|
<width>351</width>
|
||||||
|
<height>41</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<family>851MkPOP</family>
|
||||||
|
<pointsize>22</pointsize>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Settings</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="Line" name="hr">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>10</x>
|
||||||
|
<y>50</y>
|
||||||
|
<width>371</width>
|
||||||
|
<height>20</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QLabel" name="label_lang">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>20</x>
|
||||||
|
<y>90</y>
|
||||||
|
<width>351</width>
|
||||||
|
<height>31</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<family>Century Gothic</family>
|
||||||
|
<pointsize>14</pointsize>
|
||||||
|
<weight>50</weight>
|
||||||
|
<bold>false</bold>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Language</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QWidget" name="horizontalLayoutWidget">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>20</x>
|
||||||
|
<y>120</y>
|
||||||
|
<width>351</width>
|
||||||
|
<height>51</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<layout class="QHBoxLayout" name="lang_select">
|
||||||
|
<item>
|
||||||
|
<widget class="QRadioButton" name="rbtn_en">
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<family>Courier New</family>
|
||||||
|
<pointsize>14</pointsize>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>(E)</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>English</string>
|
||||||
|
</property>
|
||||||
|
<property name="shortcut">
|
||||||
|
<string>E</string>
|
||||||
|
</property>
|
||||||
|
<property name="checked">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QRadioButton" name="rbtn_ru">
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<family>Century Gothic</family>
|
||||||
|
<pointsize>14</pointsize>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>(R)</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Русский</string>
|
||||||
|
</property>
|
||||||
|
<property name="shortcut">
|
||||||
|
<string>R</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QRadioButton" name="rbtn_jp">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<family>Rounded Mplus 1c</family>
|
||||||
|
<pointsize>14</pointsize>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>(N)</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>日本語</string>
|
||||||
|
</property>
|
||||||
|
<property name="shortcut">
|
||||||
|
<string>N</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections>
|
||||||
|
<connection>
|
||||||
|
<sender>btnx</sender>
|
||||||
|
<signal>accepted()</signal>
|
||||||
|
<receiver>Dialog</receiver>
|
||||||
|
<slot>accept()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>248</x>
|
||||||
|
<y>254</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>157</x>
|
||||||
|
<y>274</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>btnx</sender>
|
||||||
|
<signal>rejected()</signal>
|
||||||
|
<receiver>Dialog</receiver>
|
||||||
|
<slot>reject()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>316</x>
|
||||||
|
<y>260</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>286</x>
|
||||||
|
<y>274</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
</connections>
|
||||||
|
</ui>
|
||||||
Binary file not shown.
@ -8,21 +8,46 @@ from PyQt5.Qt import QThread, pyqtSignal
|
|||||||
from PyQt5 import QtCore
|
from PyQt5 import QtCore
|
||||||
from requests import get as load
|
from requests import get as load
|
||||||
from bs4 import BeautifulSoup as parse
|
from bs4 import BeautifulSoup as parse
|
||||||
from time import sleep
|
from langswitch import switch
|
||||||
|
import webbrowser as web
|
||||||
|
from configer import config
|
||||||
|
|
||||||
|
|
||||||
class GUI(QMainWindow):
|
class GUI(QMainWindow):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
loadUi('GUI/MainWindow.ui',self)
|
loadUi('GUI/MainWindow.ui',self)
|
||||||
self.dlbtn.clicked.connect(self.download)
|
self.applylang()
|
||||||
|
self.btn.clicked.connect(self.download)
|
||||||
|
self.actionSettings.triggered.connect(self.show_settings)
|
||||||
|
self.actionHelp.triggered.connect(self.show_help)
|
||||||
|
|
||||||
|
def applylang(self):
|
||||||
|
self.title.setText(switch['title'][config["lang"]])
|
||||||
|
chfont(self.title,switch['title'][f'font_{config["lang"]}'])
|
||||||
|
self.input.setPlaceholderText(switch['placeholder'][config["lang"]])
|
||||||
|
chfont(self.input,switch['placeholder'][f'font_{config["lang"]}'])
|
||||||
|
self.btn.setText(switch['btn'][config["lang"]])
|
||||||
|
chfont(self.btn,switch['btn'][f'font_{config["lang"]}'])
|
||||||
|
self.menu.setTitle(switch['menu'][config["lang"]])
|
||||||
|
chfont(self.menubar,switch['menu'][f'font_{config["lang"]}'])
|
||||||
|
self.actionSettings.setText(switch['settings'][config["lang"]])
|
||||||
|
self.actionHelp.setText(switch['helpbtn'][config["lang"]])
|
||||||
|
|
||||||
def download(self):
|
def download(self):
|
||||||
# Validating input
|
# Validating input
|
||||||
songID=self.input.text()
|
songID=self.input.text()
|
||||||
|
if not songID:
|
||||||
|
self.notification=NotificationDialog(switch['empinp'][config["lang"]])
|
||||||
|
self.notification.exec()
|
||||||
|
return
|
||||||
|
elif not songID.isdigit():
|
||||||
|
self.notification=NotificationDialog(switch['typerr'][config["lang"]])
|
||||||
|
self.notification.exec()
|
||||||
|
return
|
||||||
page=parse(load(f'https://www.newgrounds.com/audio/listen/{songID}').text,'html.parser')
|
page=parse(load(f'https://www.newgrounds.com/audio/listen/{songID}').text,'html.parser')
|
||||||
if page.find(id='pageerror') is not None:
|
if page.find(id='pageerror') is not None:
|
||||||
self.notification=NotificationDialog('Incorrect input or the song doesn\'t exist!')
|
self.notification=NotificationDialog(switch['404'][config["lang"]])
|
||||||
self.notification.exec()
|
self.notification.exec()
|
||||||
return
|
return
|
||||||
self.songTitle=page.find('title').text
|
self.songTitle=page.find('title').text
|
||||||
@ -34,27 +59,36 @@ class GUI(QMainWindow):
|
|||||||
if page[i]!='\\': link+=page[i]
|
if page[i]!='\\': link+=page[i]
|
||||||
i+=1
|
i+=1
|
||||||
# Locating file
|
# Locating file
|
||||||
self.dist=QFileDialog.getSaveFileName(self,'Save File',
|
self.dist=QFileDialog.getSaveFileName(self,switch['savefile'][config["lang"]],
|
||||||
link.split('/')[-1],
|
link.split('/')[-1],
|
||||||
'MP3 Audio File (*.mp3)')[0]
|
'MP3 Audio File (*.mp3)')[0]
|
||||||
if not self.dist: return
|
if not self.dist: return
|
||||||
# Downloading
|
# Downloading
|
||||||
self.file=load(link,stream=True)
|
self.file=load(link,stream=True)
|
||||||
self.progress=ProgressDialog()
|
self.progress=ProgressDialog()
|
||||||
self.progress.label.setText(f'Downloading "{self.songTitle}"...')
|
self.progress.label.setText(switch['downloading'][config["lang"]](self.songTitle))
|
||||||
self.progress.setWindowTitle(f'Downloading "{self.songTitle}"...')
|
self.progress.setWindowTitle(switch['downloading'][config["lang"]](self.songTitle))
|
||||||
self.progress.bar.setValue(0)
|
self.progress.bar.setValue(0)
|
||||||
self.progress.exec()
|
self.progress.exec()
|
||||||
|
|
||||||
|
def show_settings(self):
|
||||||
|
self.settings=SettingsDialog()
|
||||||
|
self.settings.exec()
|
||||||
|
|
||||||
|
def show_help(self):
|
||||||
|
if config["lang"]=='en': web.open('https://github.com/H1K0/NGAudioDownloader/blob/master/README.md#newgrounds-audio-downloader--',new=2)
|
||||||
|
else: web.open(f'https://github.com/H1K0/NGAudioDownloader/blob/master/README-{config["lang"].upper()}.md#newgrounds-audio-downloader--',new=2)
|
||||||
|
|
||||||
def keyPressEvent(self,event):
|
def keyPressEvent(self,event):
|
||||||
if event.key()==16777216:
|
if event.key()==16777216: self.close()
|
||||||
self.close()
|
elif event.key()==16777220: self.download()
|
||||||
|
|
||||||
|
|
||||||
class ProgressDialog(QDialog):
|
class ProgressDialog(QDialog):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
loadUi('GUI/ProgressDialog.ui',self)
|
loadUi('GUI/ProgressDialog.ui',self)
|
||||||
|
chfont(self.label,switch['downloading'][f'font_{config["lang"]}'])
|
||||||
self.setWindowFlags(self.windowFlags()&~QtCore.Qt.WindowCloseButtonHint)
|
self.setWindowFlags(self.windowFlags()&~QtCore.Qt.WindowCloseButtonHint)
|
||||||
self.thread=DownloadThread()
|
self.thread=DownloadThread()
|
||||||
self.thread.got_chunk.connect(lambda done:self.bar.setValue(done))
|
self.thread.got_chunk.connect(lambda done:self.bar.setValue(done))
|
||||||
@ -81,7 +115,7 @@ class DownloadThread(QThread):
|
|||||||
def finish(self):
|
def finish(self):
|
||||||
global ngad
|
global ngad
|
||||||
ngad.progress.hide()
|
ngad.progress.hide()
|
||||||
ngad.notification=NotificationDialog(f'"{ngad.songTitle}" has been downloaded successfully!')
|
ngad.notification=NotificationDialog(switch['success'][config["lang"]](ngad.songTitle))
|
||||||
ngad.notification.exec()
|
ngad.notification.exec()
|
||||||
self.deleteLater()
|
self.deleteLater()
|
||||||
|
|
||||||
@ -91,14 +125,47 @@ class NotificationDialog(QDialog):
|
|||||||
super().__init__()
|
super().__init__()
|
||||||
loadUi('GUI/NotificationDialog.ui',self)
|
loadUi('GUI/NotificationDialog.ui',self)
|
||||||
self.label.setText(msg)
|
self.label.setText(msg)
|
||||||
|
chfont(self.label,switch['ntf'][f'font_{config["lang"]}'])
|
||||||
self.setWindowFlags(self.windowFlags()&~QtCore.Qt.WindowCloseButtonHint)
|
self.setWindowFlags(self.windowFlags()&~QtCore.Qt.WindowCloseButtonHint)
|
||||||
|
ngad.input.clear()
|
||||||
self.btn.clicked.connect(self.accept)
|
self.btn.clicked.connect(self.accept)
|
||||||
|
|
||||||
def accept(self):
|
def accept(self):
|
||||||
ngad.input.clear()
|
|
||||||
self.close()
|
self.close()
|
||||||
|
|
||||||
|
|
||||||
|
class SettingsDialog(QDialog):
|
||||||
|
def __init__(self):
|
||||||
|
super().__init__()
|
||||||
|
loadUi('GUI/SettingsDialog.ui',self)
|
||||||
|
self.setWindowTitle(switch['settings'][config["lang"]])
|
||||||
|
self.title.setText(switch['settings'][config["lang"]])
|
||||||
|
self.label_lang.setText(switch['lang'][config["lang"]])
|
||||||
|
chfont(self.label_lang,switch['lang'][f'font_{config["lang"]}'])
|
||||||
|
if config["lang"]=='en':
|
||||||
|
self.rbtn_en.setChecked(True)
|
||||||
|
elif config["lang"]=='ru':
|
||||||
|
self.rbtn_ru.setChecked(True)
|
||||||
|
elif config["lang"]=='jp':
|
||||||
|
self.rbtn_jp.setChecked(True)
|
||||||
|
self.newlang=config["lang"]
|
||||||
|
self.rbtn_en.toggled.connect(lambda:self.chlang('en'))
|
||||||
|
self.rbtn_ru.toggled.connect(lambda:self.chlang('ru'))
|
||||||
|
self.rbtn_jp.toggled.connect(lambda:self.chlang('jp'))
|
||||||
|
self.accepted.connect(self.updlang)
|
||||||
|
|
||||||
|
def chlang(self,newlang):
|
||||||
|
if newlang!=config["lang"]:
|
||||||
|
self.newlang=newlang
|
||||||
|
|
||||||
|
def updlang(self):
|
||||||
|
config["lang"]=self.newlang
|
||||||
|
ngad.applylang()
|
||||||
|
|
||||||
|
|
||||||
|
def chfont(unit,font): unit.setStyleSheet(f'font-family:{font}')
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
from sys import argv
|
from sys import argv
|
||||||
app=QApplication(argv)
|
app=QApplication(argv)
|
||||||
|
|||||||
33
README-JP.md
Normal file
33
README-JP.md
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
# [Newgrounds](https://newgrounds.com) Audio Downloader  
|
||||||
|
|
||||||
|
ま、Newgroundsと言えば、普通はオーディオページに結構見付かりやすいダウンロードボタンがあるけど、そのボタンのない奴もある。それも時々、素晴らしくて絶対にダウンロードしたいってゆ奴も出てくるんだ。そうなったらどうしろってんだ?
|
||||||
|
|
||||||
|
**これ**を使うんだ。
|
||||||
|
|
||||||
|
[英語](README.md)と[ロシア語](README-RU.md)のREADMEもある。
|
||||||
|
|
||||||
|
## 要求仕様
|
||||||
|
|
||||||
|
- 
|
||||||
|
- `PyQt5`ライブラリ
|
||||||
|
- `requests`ライブラリ
|
||||||
|
- `bs4`ライブラリ
|
||||||
|
- `click`ライブラリ
|
||||||
|
|
||||||
|
それともただだけを持ってこの[exeちゃん](NGAudioDownloader.exe)を使う。
|
||||||
|
|
||||||
|
## 使用法
|
||||||
|
|
||||||
|
簡単なもんだ。コイツを実行して、NSI(*Newgrounds song ID*)を入力して、Enterボタン押して、ダウンロード開始だ!
|
||||||
|
|
||||||
|
### ショートカットキー
|
||||||
|
|
||||||
|
- `Enter`でダウンロード開始
|
||||||
|
- `Alt + S`で設定画面を開く
|
||||||
|
- `F1`でヘルプを読む
|
||||||
|
|
||||||
|
### スクショ
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|

|
||||||
16
README-RU.md
16
README-RU.md
@ -1,4 +1,4 @@
|
|||||||
# Newgrounds Audio Downloader  
|
# [Newgrounds](https://newgrounds.com) Audio Downloader  
|
||||||
|
|
||||||
_Или по-славянски: качалка музлишка с ньюграундс._
|
_Или по-славянски: качалка музлишка с ньюграундс._
|
||||||
|
|
||||||
@ -6,7 +6,7 @@ _Или по-славянски: качалка музлишка с ньюгра
|
|||||||
|
|
||||||
Однако времена меняются, и теперь даже забаненные песенки можно скачать с помощью **этой самой проги**.
|
Однако времена меняются, и теперь даже забаненные песенки можно скачать с помощью **этой самой проги**.
|
||||||
|
|
||||||
При желании можно почитать [редмишку для ~~пендосов~~ инглишменов](README.md).
|
При желании можно почитать [ридмишку для пендосов и инглишменов](README.md) или [ридмишку для япошек](README-JP.md).
|
||||||
|
|
||||||
## Требования
|
## Требования
|
||||||
|
|
||||||
@ -22,12 +22,14 @@ _Или по-славянски: качалка музлишка с ньюгра
|
|||||||
|
|
||||||
Проще пареной репы. Тупо запускаешь код, вбиваешь айдишник трека и — вуаля! — скачивание пошло!
|
Проще пареной репы. Тупо запускаешь код, вбиваешь айдишник трека и — вуаля! — скачивание пошло!
|
||||||
|
|
||||||
## Скрины
|
### Горячие клавиши
|
||||||
|
|
||||||

|
- `Enter` запускает скачивание
|
||||||
|
- `Alt + S` вызывает диалог настроек
|
||||||
|
- `F1` вызывает ~~скорую~~ помощь
|
||||||
|
|
||||||

|
### Скрины
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||

|

|
||||||
16
README.md
16
README.md
@ -1,10 +1,10 @@
|
|||||||
# Newgrounds Audio Downloader  
|
# [Newgrounds](https://newgrounds.com) Audio Downloader  
|
||||||
|
|
||||||
Well, usually there's a download button on the audio page, but what to do if direct downloads are not allowed by the creator even though you love this song too much?
|
Well, usually there's a download button on the audio page, but what to do if direct downloads are not allowed by the creator even though you love this song too much?
|
||||||
|
|
||||||
You just use **this**.
|
You just use **this**.
|
||||||
|
|
||||||
You can also read the [Russian README](README-RU.md).
|
You can also read the [Russian README](README-RU.md) or [Japanese README](README-JP.md).
|
||||||
|
|
||||||
## Requirements
|
## Requirements
|
||||||
|
|
||||||
@ -20,12 +20,14 @@ Or you just use the [`NGAudioDownloader.exe`](NGAudioDownloader.exe) so all you
|
|||||||
|
|
||||||
It's easy as pie. You just run the downloader, enter your song ID and your file is being downloaded!
|
It's easy as pie. You just run the downloader, enter your song ID and your file is being downloaded!
|
||||||
|
|
||||||
## Screenshots
|
### Shortcuts
|
||||||
|
|
||||||

|
- `Enter` starts download
|
||||||
|
- `Alt + S` calls settings dialog
|
||||||
|
- `F1` calls help
|
||||||
|
|
||||||

|
### Screenshots
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||

|

|
||||||
31
configer.py
Normal file
31
configer.py
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
from json import load,dump
|
||||||
|
from os import access,F_OK
|
||||||
|
|
||||||
|
|
||||||
|
default={
|
||||||
|
"lang":"en"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
class Config:
|
||||||
|
def __init__(self):
|
||||||
|
if access('config.json',F_OK):
|
||||||
|
with open('config.json',encoding='utf-8') as file:
|
||||||
|
self.data=load(file)
|
||||||
|
else:
|
||||||
|
self.data=default
|
||||||
|
self.update()
|
||||||
|
|
||||||
|
def __getitem__(self,key):
|
||||||
|
return self.data[key]
|
||||||
|
|
||||||
|
def __setitem__(self,key,value):
|
||||||
|
self.data[key]=value
|
||||||
|
self.update()
|
||||||
|
|
||||||
|
def update(self):
|
||||||
|
with open('config.json','w',encoding='utf-8') as file:
|
||||||
|
dump(self.data,file)
|
||||||
|
|
||||||
|
|
||||||
|
config=Config()
|
||||||
90
langswitch.py
Normal file
90
langswitch.py
Normal file
@ -0,0 +1,90 @@
|
|||||||
|
switch={
|
||||||
|
"title":{
|
||||||
|
"en":"<strong>Newgrounds Audio Downloader</strong> by <em>H1K0</em>",
|
||||||
|
"ru":"<strong>Newgrounds Audio Downloader</strong> от <em>H1K0</em>",
|
||||||
|
"jp":"<em>H1K0</em> の <strong>Newgrounds Audio Downloader</strong>",
|
||||||
|
"font_en":"Comic Sans MS",
|
||||||
|
"font_ru":"Comic Sans MS",
|
||||||
|
"font_jp":"UD Digi Kyokasho N-R"
|
||||||
|
},
|
||||||
|
"placeholder":{
|
||||||
|
"en":"Enter Newgrounds song ID.",
|
||||||
|
"ru":"Введи айдишник трека на Newgrounds.",
|
||||||
|
"jp":"NSIを入力しよう!",
|
||||||
|
"font_en":"Maiandra GD",
|
||||||
|
"font_ru":"Courier New",
|
||||||
|
"font_jp":"Rounded Mplus 1c"
|
||||||
|
},
|
||||||
|
"btn":{
|
||||||
|
"en":"Download!",
|
||||||
|
"ru":"Скачать!",
|
||||||
|
"jp":"ダウンロード!",
|
||||||
|
"font_en":"Cooper Black",
|
||||||
|
"font_ru":"851CHIKARA-DZUYOKU-KANA-A",
|
||||||
|
"font_jp":"Nagurigaki Crayon"
|
||||||
|
},
|
||||||
|
"ntf":{
|
||||||
|
"font_en":"Maiandra GD",
|
||||||
|
"font_ru":"Courier New",
|
||||||
|
"font_jp":"Rounded Mplus 1c"
|
||||||
|
},
|
||||||
|
"empinp":{
|
||||||
|
"en":"Hey-hey, don't leave the input empty!",
|
||||||
|
"ru":"Эй, ну хоть что-нибудь напиши!",
|
||||||
|
"jp":"おいおい、何も入力してねえんじゃねえかよ!"
|
||||||
|
},
|
||||||
|
"typerr":{
|
||||||
|
"en":"Newgrounds song ID consists of digits only!",
|
||||||
|
"ru":"Айдишник трека состоит только из цифр!",
|
||||||
|
"jp":"NSIは数字だけだ!"
|
||||||
|
},
|
||||||
|
"404":{
|
||||||
|
"en":"And there's no song with this ID!",
|
||||||
|
"ru":"А нет песенки с таким айдишником!",
|
||||||
|
"jp":"そのNSIの曲は存在してないな!"
|
||||||
|
},
|
||||||
|
"savefile":{
|
||||||
|
"en":"Save file",
|
||||||
|
"ru":"Сохранить файл",
|
||||||
|
"jp":"ファイル保存"
|
||||||
|
},
|
||||||
|
"downloading":{
|
||||||
|
"en":lambda songTitle:f'Downloading «{songTitle}»...',
|
||||||
|
"ru":lambda songTitle:f'Скачивание трека «{songTitle}»...',
|
||||||
|
"jp":lambda songTitle:f'「{songTitle}」ダウンロード中・・・',
|
||||||
|
"font_en":"Maiandra GD",
|
||||||
|
"font_ru":"Courier New",
|
||||||
|
"font_jp":"Rounded Mplus 1c"
|
||||||
|
},
|
||||||
|
"success":{
|
||||||
|
"en":lambda songTitle:f'«{songTitle}» has been downloaded successfully!',
|
||||||
|
"ru":lambda songTitle:f'«{songTitle}»: скачано!',
|
||||||
|
"jp":lambda songTitle:f'「{songTitle}」ダウンロード完了!'
|
||||||
|
},
|
||||||
|
"menu":{
|
||||||
|
"en":"MENU",
|
||||||
|
"ru":"МЕНЮ",
|
||||||
|
"jp":"メニュー",
|
||||||
|
"font_en":"Century Gothic",
|
||||||
|
"font_ru":"Century Gothic",
|
||||||
|
"font_jp":"Rounded Mplus 1c"
|
||||||
|
},
|
||||||
|
"settings":{
|
||||||
|
"en":"Settings",
|
||||||
|
"ru":"Настройки",
|
||||||
|
"jp":"設定"
|
||||||
|
},
|
||||||
|
"helpbtn":{
|
||||||
|
"en":"Help",
|
||||||
|
"ru":"Помощь",
|
||||||
|
"jp":"ヘルプ"
|
||||||
|
},
|
||||||
|
"lang":{
|
||||||
|
"en":"Language",
|
||||||
|
"ru":"Язык",
|
||||||
|
"jp":"言語",
|
||||||
|
"font_en":"Century Gothic",
|
||||||
|
"font_ru":"Century Gothic",
|
||||||
|
"font_jp":"Rounded Mplus 1c"
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
settings.ico
Normal file
BIN
settings.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.2 KiB |
Reference in New Issue
Block a user