Compare commits
No commits in common. "a849097a471503372ca10d3b111b2f9b40b84946" and "7f790a2e8217b6214d17eaffafc85706695433c9" have entirely different histories.
a849097a47
...
7f790a2e82
5
.gitignore
vendored
5
.gitignore
vendored
@ -1,6 +1,3 @@
|
|||||||
__pycache__
|
__pycache__
|
||||||
build*
|
build*
|
||||||
_dump
|
*.spec
|
||||||
*.exe
|
|
||||||
*.spec
|
|
||||||
/config.json
|
|
||||||
@ -47,15 +47,15 @@
|
|||||||
</property>
|
</property>
|
||||||
<property name="font">
|
<property name="font">
|
||||||
<font>
|
<font>
|
||||||
<family>Comic Sans MS</family>
|
<family>Century Gothic</family>
|
||||||
<pointsize>22</pointsize>
|
<pointsize>20</pointsize>
|
||||||
</font>
|
</font>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string><strong>Newgrounds Audio Downloader</strong> by <em>H1K0</em></string>
|
<string>Newgrounds Audio Downloader by H1K0</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="alignment">
|
<property name="alignment">
|
||||||
<set>Qt::AlignBottom|Qt::AlignHCenter</set>
|
<set>Qt::AlignCenter</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>Maiandra GD</family>
|
<family>Courier New</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="btn">
|
<widget class="QPushButton" name="dlbtn">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>20</x>
|
<x>20</x>
|
||||||
@ -101,14 +101,11 @@
|
|||||||
<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>Ctrl+S</string>
|
<string>Return</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
@ -118,33 +115,9 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>600</width>
|
<width>600</width>
|
||||||
<height>23</height>
|
<height>21</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">
|
||||||
@ -162,36 +135,6 @@
|
|||||||
<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/>
|
||||||
|
|||||||
@ -1,94 +0,0 @@
|
|||||||
<?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>150</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>150</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="maximumSize">
|
|
||||||
<size>
|
|
||||||
<width>400</width>
|
|
||||||
<height>150</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="windowTitle">
|
|
||||||
<string>ACHTUNG!</string>
|
|
||||||
</property>
|
|
||||||
<property name="windowIcon">
|
|
||||||
<iconset>
|
|
||||||
<normaloff>../icon.ico</normaloff>../icon.ico</iconset>
|
|
||||||
</property>
|
|
||||||
<widget class="QLabel" name="label">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>30</x>
|
|
||||||
<y>30</y>
|
|
||||||
<width>331</width>
|
|
||||||
<height>61</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="font">
|
|
||||||
<font>
|
|
||||||
<family>Maiandra GD</family>
|
|
||||||
<pointsize>16</pointsize>
|
|
||||||
</font>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>ACHTUNG!</string>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
|
||||||
</property>
|
|
||||||
<property name="wordWrap">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<property name="indent">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
<widget class="QPushButton" name="btn">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>280</x>
|
|
||||||
<y>100</y>
|
|
||||||
<width>81</width>
|
|
||||||
<height>31</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="font">
|
|
||||||
<font>
|
|
||||||
<family>Cooper Black</family>
|
|
||||||
<pointsize>14</pointsize>
|
|
||||||
</font>
|
|
||||||
</property>
|
|
||||||
<property name="cursor">
|
|
||||||
<cursorShape>PointingHandCursor</cursorShape>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>OK!</string>
|
|
||||||
</property>
|
|
||||||
<property name="shortcut">
|
|
||||||
<string>Return</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</widget>
|
|
||||||
<resources/>
|
|
||||||
<connections/>
|
|
||||||
</ui>
|
|
||||||
@ -39,23 +39,20 @@
|
|||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>20</x>
|
<x>20</x>
|
||||||
<y>20</y>
|
<y>30</y>
|
||||||
<width>451</width>
|
<width>451</width>
|
||||||
<height>31</height>
|
<height>21</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="font">
|
<property name="font">
|
||||||
<font>
|
<font>
|
||||||
<family>Maiandra GD</family>
|
<family>Courier New</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">
|
||||||
@ -66,14 +63,11 @@
|
|||||||
<height>25</height>
|
<height>25</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="cursor">
|
|
||||||
<cursorShape>BusyCursor</cursorShape>
|
|
||||||
</property>
|
|
||||||
<property name="maximum">
|
<property name="maximum">
|
||||||
<number>100</number>
|
<number>100</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="value">
|
<property name="value">
|
||||||
<number>54</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="textVisible">
|
<property name="textVisible">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
|
|||||||
@ -1,230 +0,0 @@
|
|||||||
<?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,189 +8,88 @@ 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 langswitch import switch
|
from time import sleep
|
||||||
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.applylang()
|
self.dlbtn.clicked.connect(self.download)
|
||||||
self.btn.clicked.connect(self.download)
|
self.inprocess=False
|
||||||
self.actionSettings.triggered.connect(self.show_settings)
|
|
||||||
self.actionHelp.triggered.connect(self.show_help)
|
|
||||||
|
|
||||||
def applylang(self):
|
def download(self):
|
||||||
self.title.setText(switch['title'][config["lang"]])
|
self.inprocess=True
|
||||||
chfont(self.title, switch['title'][f'font_{config["lang"]}'])
|
# Validating input
|
||||||
self.input.setPlaceholderText(switch['placeholder'][config["lang"]])
|
songID=self.input.text()
|
||||||
chfont(self.input, switch['placeholder'][f'font_{config["lang"]}'])
|
page=parse(load(f'https://www.newgrounds.com/audio/listen/{songID}').text,'html.parser')
|
||||||
self.btn.setText(switch['btn'][config["lang"]])
|
if page.find(id='pageerror') is not None:
|
||||||
chfont(self.btn, switch['btn'][f'font_{config["lang"]}'])
|
self.input.clear()
|
||||||
self.menu.setTitle(switch['menu'][config["lang"]])
|
return
|
||||||
chfont(self.menubar, switch['menu'][f'font_{config["lang"]}'])
|
songTitle=page.find('title').text
|
||||||
self.actionSettings.setText(switch['settings'][config["lang"]])
|
# Getting download link
|
||||||
self.actionHelp.setText(switch['helpbtn'][config["lang"]])
|
link='http://audio.ngfiles.com/'
|
||||||
|
page=str(page)
|
||||||
def download(self):
|
i=page.find('audio.ngfiles.com')+len('audio.ngfiles.com/')
|
||||||
# Validating input
|
while not link.endswith('.mp3'):
|
||||||
songID = self.input.text()
|
if page[i]!='\\': link+=page[i]
|
||||||
if not songID:
|
i+=1
|
||||||
self.notification = NotificationDialog(
|
# Locating file
|
||||||
switch['empinp'][config["lang"]])
|
dist=QFileDialog.getSaveFileName(self,'Save File',
|
||||||
self.notification.exec()
|
link.split('/')[-1],
|
||||||
return
|
'MP3 Audio File (*.mp3)')[0]
|
||||||
elif not songID.isdigit():
|
if not dist: return
|
||||||
self.notification = NotificationDialog(
|
# Downloading
|
||||||
switch['typerr'][config["lang"]])
|
file=load(link,stream=True)
|
||||||
self.notification.exec()
|
global progress
|
||||||
return
|
progress.label.setText(f'Downloading "{songTitle}"...')
|
||||||
page = parse(load('https://www.newgrounds.com/audio/listen/'
|
progress.setWindowTitle(f'Downloading "{songTitle}"...')
|
||||||
f'{songID}').text, 'html.parser')
|
progress.bar.setValue(0)
|
||||||
if page.find(id='pageerror') is not None:
|
progress.show()
|
||||||
self.notification = NotificationDialog(
|
self.thread=DownloadThread(file,dist)
|
||||||
switch['404'][config["lang"]])
|
self.thread.got_chunk.connect(lambda done:progress.bar.setValue(done))
|
||||||
self.notification.exec()
|
self.thread.finished.connect(self.thread.finish)
|
||||||
return
|
self.thread.start()
|
||||||
self.songTitle = page.find('title').text
|
self.input.clear()
|
||||||
# Getting download link
|
self.inprocess=False
|
||||||
link = 'http://audio.ngfiles.com/'
|
|
||||||
page = str(page)
|
|
||||||
i = page.find('audio.ngfiles.com')+len('audio.ngfiles.com/')
|
|
||||||
while not link.endswith('.mp3'):
|
|
||||||
if page[i] != '\\':
|
|
||||||
link += page[i]
|
|
||||||
i += 1
|
|
||||||
# Locating file
|
|
||||||
self.dist = (QFileDialog.
|
|
||||||
getSaveFileName(self, switch['savefile'][config["lang"]],
|
|
||||||
link.split('/')[-1],
|
|
||||||
'MP3 Audio File (*.mp3)')[0])
|
|
||||||
if not self.dist:
|
|
||||||
return
|
|
||||||
# Downloading
|
|
||||||
self.file = load(link, stream=True)
|
|
||||||
self.progress = ProgressDialog()
|
|
||||||
self.progress.label.setText(
|
|
||||||
switch['downloading'][config["lang"]](self.songTitle))
|
|
||||||
self.progress.setWindowTitle(
|
|
||||||
switch['downloading'][config["lang"]](self.songTitle))
|
|
||||||
self.progress.bar.setValue(0)
|
|
||||||
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('https://github.com/H1K0/NGAudioDownloader/blob/master/'
|
|
||||||
f'README-{config["lang"].upper()}.md#'
|
|
||||||
'newgrounds-audio-downloader--', new=2)
|
|
||||||
|
|
||||||
def keyPressEvent(self, event):
|
|
||||||
if event.key() == 16777216:
|
|
||||||
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.got_chunk.connect(lambda done: self.bar.setValue(done))
|
|
||||||
self.thread.finished.connect(self.thread.finish)
|
|
||||||
self.thread.start()
|
|
||||||
|
|
||||||
|
|
||||||
class DownloadThread(QThread):
|
class DownloadThread(QThread):
|
||||||
got_chunk = pyqtSignal(object)
|
got_chunk=pyqtSignal(object)
|
||||||
|
|
||||||
def __init__(self): super().__init__()
|
def __init__(self,file,dist):
|
||||||
|
super().__init__()
|
||||||
|
self.file,self.dist=file,dist
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
total = ngad.file.headers.get('content-length')
|
global progress
|
||||||
if total is None:
|
total=self.file.headers.get('content-length')
|
||||||
total = -1
|
if total is None: total=-1
|
||||||
else:
|
else: total=int(total)
|
||||||
total = int(total)
|
downloaded=0
|
||||||
downloaded = 0
|
with open(self.dist,'wb') as out:
|
||||||
with open(ngad.dist, 'wb') as out:
|
for data in self.file.iter_content(chunk_size=max(total//100,1024)):
|
||||||
for data in (ngad.file.
|
downloaded+=len(data)
|
||||||
iter_content(chunk_size=max(total//100, 1024))):
|
out.write(data)
|
||||||
downloaded += len(data)
|
self.got_chunk.emit(100*downloaded//total)
|
||||||
out.write(data)
|
|
||||||
self.got_chunk.emit(100*downloaded//total)
|
|
||||||
|
|
||||||
def finish(self):
|
def finish(self):
|
||||||
global ngad
|
global progress
|
||||||
ngad.progress.hide()
|
progress.hide()
|
||||||
ngad.notification = NotificationDialog(
|
self.deleteLater()
|
||||||
switch['success'][config["lang"]](ngad.songTitle))
|
|
||||||
ngad.notification.exec()
|
|
||||||
self.deleteLater()
|
|
||||||
|
|
||||||
|
|
||||||
class NotificationDialog(QDialog):
|
|
||||||
def __init__(self, msg):
|
|
||||||
super().__init__()
|
|
||||||
loadUi('GUI/NotificationDialog.ui', self)
|
|
||||||
self.label.setText(msg)
|
|
||||||
chfont(self.label, switch['ntf'][f'font_{config["lang"]}'])
|
|
||||||
self.setWindowFlags(self.windowFlags() & ~
|
|
||||||
QtCore.Qt.WindowCloseButtonHint)
|
|
||||||
ngad.input.clear()
|
|
||||||
self.btn.clicked.connect(self.accept)
|
|
||||||
|
|
||||||
def accept(self):
|
|
||||||
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)
|
||||||
ngad = GUI()
|
ngad=GUI()
|
||||||
|
progress=ProgressDialog()
|
||||||
ngad.show()
|
ngad.show()
|
||||||
sys.exit(app.exec_())
|
sys.exit(app.exec_())
|
||||||
43
README-JP.md
43
README-JP.md
@ -1,43 +0,0 @@
|
|||||||
# [Newgrounds](https://newgrounds.com) Audio Downloader  
|
|
||||||
|
|
||||||
ま、Newgroundsと言えば、普通はオーディオページに結構見付かりやすいダウンロードボタンがあるけど、そのボタンのない奴もある。それも時々、素晴らしくて絶対にダウンロードしたいーってゆ奴も出てくるよな。そうなったらどうしろってんだ?
|
|
||||||
|
|
||||||
**コイツ**を使うんだ。
|
|
||||||
|
|
||||||
後、[英語](README.md#newgrounds-audio-downloader--)と[ロシア語](README-RU.md#newgrounds-audio-downloader--)のREADMEもある。
|
|
||||||
|
|
||||||
## 必要な物とは?
|
|
||||||
|
|
||||||
- 
|
|
||||||
- `PyQt5`ライブラリ
|
|
||||||
- `requests`ライブラリ
|
|
||||||
- `bs4`ライブラリ
|
|
||||||
- `click`ライブラリ
|
|
||||||
|
|
||||||
それともただだけを持って、この[アーカイブ](NGAudioDownloader.zip)をダウンロードして、[exeちゃん](NGAudioDownloader.exe)を使って楽になってもいい。
|
|
||||||
|
|
||||||
## 早速始めたい!
|
|
||||||
|
|
||||||
### 一般人の方(法)
|
|
||||||
|
|
||||||
ま、[`NGAudioDownloader.zip`](https://github.com/H1K0/NGAudioDownloader/raw/master/NGAudioDownloader.zip)をダウンロードして、ソイツをどっかで解凍して、`NGAudioDownloader.exe`を実行させるだけ。
|
|
||||||
|
|
||||||
<big>※注意:</big>コイツに時計のように正常に作動して欲しいってんなら、絶対に、アーカイブから抽出されたファイルを**移動/削除したりすんじゃねえぞ**!
|
|
||||||
|
|
||||||
### Pythonistの方(法)
|
|
||||||
|
|
||||||
ま、[リポジトリ全体をダウンロード](https://github.com/H1K0/NGAudioDownloader/archive/master.zip)して、`NGAudioDownloader.py`を実行だ。はい、終了~!
|
|
||||||
|
|
||||||
## で、後はどうするの?
|
|
||||||
|
|
||||||
簡単なもんやろ。コイツを実行して、NSI(*Newgrounds song ID*)を入力して、`Enter`ボタン押して、ダウンロード開始だ!
|
|
||||||
|
|
||||||
### どこ押したらいい?
|
|
||||||
|
|
||||||
- `Enter`でダウンロード開始
|
|
||||||
- `Alt + S`で設定画面を開く
|
|
||||||
- `F1`でヘルプを読む
|
|
||||||
|
|
||||||
## あのー、なんかビデオガイドとかないんですかー?
|
|
||||||
|
|
||||||
Pythonistならもう分かってる筈なんだから、[一般人向けのビデオガイド](https://yadi.sk/i/9krScj2BHcr3Rg)。
|
|
||||||
45
README-RU.md
45
README-RU.md
@ -1,45 +0,0 @@
|
|||||||
# [Newgrounds](https://newgrounds.com) Audio Downloader  
|
|
||||||
|
|
||||||
_Или по-славянски: качалка музлишка с ньюграундс._
|
|
||||||
|
|
||||||
Ну, вообще-то на нг обычно есть кнопка для скачивания, однако иногда авторы запрещают прямое скачивание, и как бы сильно тебе ни нравилась песенка, ты не сможешь ее так просто заполучить.
|
|
||||||
|
|
||||||
Однако времена меняются, и теперь даже забаненные песенки можно скачать с помощью **этой самой проги**.
|
|
||||||
|
|
||||||
При желании можно почитать [ридмишку для пендосов и инглишменов](README.md#newgrounds-audio-downloader--) или [ридмишку для япошек](README-JP.md#newgrounds-audio-downloader--).
|
|
||||||
|
|
||||||
## Что расчехлять?
|
|
||||||
|
|
||||||
- 
|
|
||||||
- Либа `PyQt5`
|
|
||||||
- Либа `requests`
|
|
||||||
- Либа `bs4`
|
|
||||||
- Либа `click`
|
|
||||||
|
|
||||||
Или же можно тупо скачать [архивчик](NGAudioDownloader.zip), жмыхнуть ехешник и вообще не париться, если у тебя .
|
|
||||||
|
|
||||||
## Ну чо, пацаны, поехали!
|
|
||||||
|
|
||||||
### Старт юзверя
|
|
||||||
|
|
||||||
Короче, скачиваешь [`NGAudioDownloader.zip`](https://github.com/H1K0/NGAudioDownloader/raw/master/NGAudioDownloader.zip), извлекаешь куда-нибудь и фигачишь `NGAudioDownloader.exe`.
|
|
||||||
|
|
||||||
<big>※И ДА:</big> если хочешь, чтобы качалка работала, как швейцарские часики, **не смей перемещать/удалять** какие-либо файлы, извлеченные из архива! Иначе огребешь **БАН**. <span title="Это морда пажылого борова палучаеца." style="cursor:help">;-\
|
|
||||||
|
|
||||||
### Старт питониста
|
|
||||||
|
|
||||||
Короче, [скачиваешь весь репозиторий](https://github.com/H1K0/NGAudioDownloader/archive/master.zip) и фигачишь `NGAudioDownloader.py`. Финита. :3
|
|
||||||
|
|
||||||
## Ок, че дальше?
|
|
||||||
|
|
||||||
Проще пареной репы. Тупо запускаешь код, вбиваешь айдишник трека и — вуаля! — скачивание пошло!
|
|
||||||
|
|
||||||
### Куды тыкать-то?
|
|
||||||
|
|
||||||
- `Enter` запускает скачивание
|
|
||||||
- `Alt + S` вызывает диалог настроек
|
|
||||||
- `F1` вызывает ~~скорую~~ помощь
|
|
||||||
|
|
||||||
## А видеогайда нет?
|
|
||||||
|
|
||||||
Ну, предполагается, что питонисты и так прошаренные, так что вот [видеогайд для юзверей](https://yadi.sk/i/9krScj2BHcr3Rg).
|
|
||||||
32
README.md
32
README.md
@ -1,12 +1,10 @@
|
|||||||
# [Newgrounds](https://newgrounds.com) Audio Downloader  
|
# Newgrounds 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#newgrounds-audio-downloader--) or [Japanese README](README-JP.md#newgrounds-audio-downloader--).
|
## Requirements
|
||||||
|
|
||||||
## So, what do I actually need?
|
|
||||||
|
|
||||||
- 
|
- 
|
||||||
- `PyQt5` library
|
- `PyQt5` library
|
||||||
@ -14,30 +12,14 @@ You can also read the [Russian README](README-RU.md#newgrounds-audio-downloader-
|
|||||||
- `bs4` library
|
- `bs4` library
|
||||||
- `click` library
|
- `click` library
|
||||||
|
|
||||||
Or you just use the `.exe` file from [`NGAudioDownloader.zip`](NGAudioDownloader.zip) so all you need is .
|
Or you just use the [`NGAudioDownloader.exe`](NGAudioDownloader.exe) so all you need is .
|
||||||
|
|
||||||
## Let's get it started!
|
## Usage
|
||||||
|
|
||||||
### I'm a civilian
|
|
||||||
|
|
||||||
You just download [`NGAudioDownloader.zip`](https://github.com/H1K0/NGAudioDownloader/raw/master/NGAudioDownloader.zip), extract it somewhere and run the `NGAudioDownloader.exe`.
|
|
||||||
|
|
||||||
<big>※NOTE:</big> if you want this downloader working correctly **DO NOT move/delete** any files extracted from the archive!
|
|
||||||
|
|
||||||
### I'm a pythonist
|
|
||||||
|
|
||||||
You just [download the whole repository](https://github.com/H1K0/NGAudioDownloader/archive/master.zip) and run `NGAudioDownloader.py`. That's all. :3
|
|
||||||
|
|
||||||
## What should I do then?
|
|
||||||
|
|
||||||
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!
|
||||||
|
|
||||||
### Where should I press?
|
## Screenshots
|
||||||
|
|
||||||
- `Enter` starts download
|

|
||||||
- `Alt + S` calls settings dialog
|
|
||||||
- `F1` calls help
|
|
||||||
|
|
||||||
## Is there any video guide?
|

|
||||||
|
|
||||||
Well, pythonists are considered already understanding how it all works, so here's the [video guide for civilians](https://yadi.sk/i/9krScj2BHcr3Rg).
|
|
||||||
31
configer.py
31
configer.py
@ -1,31 +0,0 @@
|
|||||||
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()
|
|
||||||
@ -1,90 +0,0 @@
|
|||||||
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
BIN
settings.ico
Binary file not shown.
|
Before Width: | Height: | Size: 4.2 KiB |
Reference in New Issue
Block a user