Skip to content

Commit

Permalink
Merge pull request #7 from bbtufty/reg-lang
Browse files Browse the repository at this point in the history
Add region/language preferences
  • Loading branch information
bbtufty authored Oct 20, 2024
2 parents 5bec5a7 + 1bca6f6 commit fce6cfa
Show file tree
Hide file tree
Showing 22 changed files with 1,307 additions and 151 deletions.
1 change: 1 addition & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
0.2 (Unreleased)
================

- Add configurable region/language preferences [#7]
- Ensure package name is valid for JDownloader [#6]

0.1 (2024-10-19)
Expand Down
20 changes: 20 additions & 0 deletions docs/advanced_usage.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
############
Advanced Use
############

Region and Language Priorities
==============================

For users who want more granular control over which release to grab when there are multiple, we expose region/language
priorities. The menu looks like this:

.. image:: img/gui_region_language.png

If there are multiple releases, we parse regions and languages, and will remove any releases that aren't in selected
region or language preferences. At this stage, the ordering of regions and languages is not important.

Following this, we then score if there are multiple remaining releases. We prioritise region over language, so, for
instance, if you have Europe above USA in the region priority, but language set to English, you would grab the EU
version over the US version. Here, the ordering of the regions and languages is now important!

This should ensure that you grab 1 preferred release over all others.
Binary file modified docs/img/gui.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/img/gui_region_language.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

installation
usage
advanced_usage
changelog
reference_api

Expand Down
2 changes: 2 additions & 0 deletions docs/intro.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,6 @@ For details on installation, see :doc:`installation <installation>`.

For how to use NXBrew-dl, see :doc:`usage <usage>`.

For advanced topics, see :doc:`advanced usage <advanced_usage>`.

We encourage users to open `issues <https://github.com/bbtufty/nxbrew-dl/issues>`_ as and where they find them.
4 changes: 4 additions & 0 deletions docs/reference_api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ GUI
:members:
:undoc-members:

.. autoclass:: nxbrew_dl.gui.RegionLanguageWindow
:members:
:undoc-members:

.. autoclass:: nxbrew_dl.gui.AboutWindow
:members:
:undoc-members:
Expand Down
9 changes: 8 additions & 1 deletion docs/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,14 @@ downloading!
We then have ROM options. These are whether you prefer NSP or XCI files, and whether you would like to download
associated updates and DLC, if available.

Finally, we have the Discord integration. If a URL is set here, then NXBrew-dl will post a summary of downloaded files
We expose region and language preferences through an advanced option. By default, we have the USA release as top
priority, followed by Europe. For languages, we only allow languages that are marked as English. This should be
reasonable for the average user but can be configured. To do that, see :doc:`advanced usage <advanced_usage>`.

There is also a dry run option. If checked, will parse webpages but not download anything, or update the cache file.
Mainly useful for testing.

Finally, we have Discord integration. If a URL is set here, then NXBrew-dl will post a summary of downloaded files
via the Discord webhook. For details on how to set this up, see
`here <https://support.discord.com/hc/en-us/articles/228383668-Intro-to-Webhooks>`_.

Expand Down
65 changes: 64 additions & 1 deletion nxbrew_dl/configs/general.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ dl_sites:
- "1Fichier"
- "FreeDL"
- "GoFile"
- "HexLoad"
- "MegaUp"

dl_names:
Expand All @@ -15,6 +16,13 @@ dl_names:
forbidden_titles:
- "Latest RAW Game Updates [17th April 2024][47 New Updates] [DISCONTINUED]"

default_selected_regions:
- "USA"
- "Europe"

default_selected_languages:
- "English"

regions:
USA: "USA|UAS"
Europe: "EUR"
Expand Down Expand Up @@ -75,4 +83,59 @@ languages:
Tamil: "Ta"
Thai: "Th"
Turkish: "Tr"
Ukranian: "Uk"
Ukranian: "Uk"

implied_languages:
USA: "English"
World: "English"
Canada: "English"
Europe: "English"
UK: "English"
Australia: "English"
New Zealand: "English"
Singapore: "English"
Ireland: "English"
Japan: "Japanese"
Spain: "Spanish"
Mexico: "Spanish (Mexican)"
Argentina: "Spanish"
Latin America: "Spanish (Latin American)"
Brazil: "Portuguese (Brazilian)"
Portugal: "Portuguese"
France: "French"
Belgium: "French"
Netherlands: "Dutch"
Germany: "German"
Austria: "German"
Italy: "Italian"
Hong Kong: "Chinese (Traditional)"
China: "Chinese (Simplified)"
Taiwan: "Chinese (Traditional)"
Korea: "Korean"
Russia: "Russian"
Estonia: "Estonian"
Poland: "Polish"
Latvia: "Latvian"
Lithuania: "Lithuanian"
Denmark: "Danish"
Norway: "Norwegian"
Sweden: "Swedish"
Finland: "Finnish"
Iceland: "Icelandic"
Hungary: "Hungarian"
Czech: "Czech"
Greece: "Greek"
Macedonia: "Macedonian"
India: "English"
Israel: "Hebrew"
Slovakia: "Slovakian"
Turkey: "Turkish"
Croatia: "Croatian"
Slovenia: "Slovenian"
United Arab Emirates: "Arabic"
Bulgaria: "Bulgarian"
Romania: "Romanian"
Albania: "Albanian"
Serbia: "Serbian"
Indonesia: "Indonesian"
Unknown: "English"
2 changes: 2 additions & 0 deletions nxbrew_dl/gui/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
from .gui_nxbrew_dl import MainWindow
from .gui_regions_languages import RegionLanguageWindow
from .gui_about import AboutWindow

__all__ = [
"MainWindow",
"RegionLanguageWindow",
"AboutWindow",
]
14 changes: 13 additions & 1 deletion nxbrew_dl/gui/custom_widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def set_dl(
row_position (int): Row position
"""

dl = QTableWidgetItem()
dl = SortableCheckboxTableWidgetItem()
dl.setTextAlignment(Qt.AlignmentFlag.AlignHCenter)
dl.setCheckState(Qt.CheckState.Unchecked)

Expand Down Expand Up @@ -157,3 +157,15 @@ def set_filetype(
has_filetype.setFlags(Qt.ItemFlag.ItemIsEnabled)

table.setItem(row_position, column_position, has_filetype)

class SortableCheckboxTableWidgetItem(QTableWidgetItem):
"""Modified checkbox that allows for sorting"""

def __lt__(self, other):
"""Edit the less than operator"""

if self.checkState() == other.checkState():
return False
elif self.checkState() == Qt.CheckState.Checked:
return False
return True
Loading

0 comments on commit fce6cfa

Please sign in to comment.