Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[add] translations filter: Filter by translations #3019

Open
wants to merge 7 commits into
base: develop
Choose a base branch
from

Conversation

soloam
Copy link
Contributor

@soloam soloam commented May 27, 2021

Motivation for changes:

Filter entry based on translations (subbed or dubbed) and original language

Detailed changes:

  • add translations plugin

Config:

        tasks:
            dubbed1:
                mock:
                    - { title: "Attack on Titan S01E01 DUBFrench DUBItalian 720p WEBRip", url: "http://mock.url/file2.torrent" }
                    - { title: "Attack on Titan S01E01 French 720p WEBRip", url: "http://mock.url/file2.torrent" }
                    - { title: "Attack on Titan S01E01 720p WEBRip", url: "http://mock.url/file2.torrent" }
                    - { title: "Attack on Titan S01E01 720p Japanese", url: "http://mock.url/file2.torrent" }


                translations:
                    languages:
                        - "japanese"
                    dubbed:
                        japanese: "accept"
                        default: "reject"

                series:
                    - Attack on Titan:
                        identified_by: ep



            dubbed2:
                mock:
                    - { title: "Show S01E01 Tuga 720p", trakt_series_language:"english", url:"http://mock.url/file2.torrent" }
                    - { title: "Show S01E01 720p",  trakt_series_language:"english", url:"http://mock.url/file2.torrent" }

                translations:
                    languages_synonyms:
                        portuguese:
                            - tuga
                    languages:
                        - "trakt_series_language"
                    dubbed:
                        portuguese: "accept"
                        default: "reject"

                series:
                    - Show:
                        identified_by: ep


            dubbed3:
                mock:
                    - { title: "Movie French 720p", movie_name: "Movie", trakt_language: "english", url:"http://mock.url/file2.torrent" }
                    - { title: "Movie Spanish 720p", movie_name: "Movie",  trakt_language: "english", url:"http://mock.url/file2.torrent" }
                    - { title: "Movie English 720p", movie_name: "Movie",  trakt_language: "english", url:"http://mock.url/file2.torrent" }
                    - { title: "Movie 720p", movie_name: "Movie",  trakt_language: "english", url:"http://mock.url/file2.torrent" }
                    - { title: "Movie En 720p", movie_name: "Movie",  trakt_language: "english", url:"http://mock.url/file2.torrent" }

                translations:
                    languages:
                        - "trakt_language"
                    dubbed: reject

            dubbed_accept:
                mock:
                    - { title: "Movie Dub 720p", movie_name: "Movie", url:"http://mock.url/file2.torrent" }
                    - { title: "Movie Dubbed 720p", movie_name: "Movie", url:"http://mock.url/file2.torrent" }
                    - { title: "Movie 720p", movie_name: "Movie", url:"http://mock.url/file2.torrent" }
                    - { title: "Movie PT_BR 720p", movie_name: "Movie", url:"http://mock.url/file2.torrent" }
                    - { title: "Movie French 720p", movie_name: "Movie", url:"http://mock.url/file2.torrent" }

                translations: accept

            dubbed_reject:
                mock:
                    - { title: "Movie Dub 720p", movie_name: "Movie", url:"http://mock.url/file2.torrent" }
                    - { title: "Movie Dubbed 720p", movie_name: "Movie", url:"http://mock.url/file2.torrent" }
                    - { title: "Movie 720p", movie_name: "Movie", url:"http://mock.url/file2.torrent" }
                    - { title: "Movie PT_BR 720p", movie_name: "Movie", url:"http://mock.url/file2.torrent" }
                    - { title: "Movie French 720p", movie_name: "Movie", url:"http://mock.url/file2.torrent" }

                translations: reject

            subbed1:
                mock:
                    - { title: "Attack on Titan S01E01 SubFrench SubItalian 720p WEBRip", url: "http://mock.url/file2.torrent" }
                    - { title: "Attack on Titan S01E01 SubEnglish 720p WEBRip", url: "http://mock.url/file2.torrent" }
                    - { title: "Attack on Titan S01E01 720p WEBRip", url: "http://mock.url/file2.torrent" }
                    - { title: "Attack on Titan S01E01 720p SubJapanese", url: "http://mock.url/file2.torrent" }
                    - { title: "Attack on Titan S01E01 720p Subbed", url: "http://mock.url/file2.torrent" }


                translations:
                    languages:
                        - "japanese"
                    dubbed: reject
                    subbed:
                        english: "do_nothing"
                        default: "reject"

                series:
                    - Attack on Titan:
                        parse_only: yes
                        identified_by: ep

            subbed2:
                mock:
                    - { title: "Attack on Titan S01E01 SubFrench SubItalian 720p WEBRip", url: "http://mock.url/file2.torrent" }
                    - { title: "Attack on Titan S01E01 SubEnglish 720p WEBRip", url: "http://mock.url/file2.torrent" }
                    - { title: "Attack on Titan S01E01 720p WEBRip", url: "http://mock.url/file2.torrent" }
                    - { title: "Attack on Titan S01E01 720p SubJapanese", url: "http://mock.url/file2.torrent" }
                    - { title: "Attack on Titan S01E01 720p Subbed", url: "http://mock.url/file2.torrent" }


                translations:
                    languages:
                        - "japanese"
                    dubbed: reject
                    subbed: reject

                series:
                    - Attack on Titan:
                        parse_only: yes
                        identified_by: ep

            subbed3:
                mock:
                    - { title: "Attack on Titan S01E01 SubFrench SubItalian 720p", url: "http://mock.url/file2.torrent" }
                    - { title: "Attack on Titan S01E01 SubEnglish 720p WEBRip", url: "http://mock.url/file2.torrent" }
                    - { title: "Attack on Titan S01E01 720p WEBRip", url: "http://mock.url/file2.torrent" }
                    - { title: "Attack on Titan S01E01 720p SubJapanese", url: "http://mock.url/file2.torrent" }
                    - { title: "Attack on Titan S01E01 720p Subbed", url: "http://mock.url/file2.torrent" }


                translations:
                    languages:
                        - "japanese"
                    dubbed: reject
                    subbed: 
                        none: reject
                        default: accept

                series:
                    - Attack on Titan:
                        parse_only: yes
                        identified_by: ep


            do_nothing_test:
                mock:
                    - {'title':'Movie1.720p.PT.ENG.TEST','url':'mock://teste1'}
                    - {'title':'Movie2.720p.Portugues.Ingles.TEST','url':'mock://teste2'}
                    - {'title':'Movie3.1080p.ENG.PT.BluRay.TEST','url':'mock://teste3'}
                translations:
                    languages_synonyms:
                        portuguese:
                            - tuga
                            - portuga
                            - portugues
                        english:
                            - ingles
                            - ing
                        spanish:
                            - espanhol
                        french:
                            - frances
                    dubbed:
                        portuguese: "do_nothing"
                        default: "reject"

Log and/or tests output (preferably both):

Test cases in test_translations_filter.py

To Do:

  • If merged add to wiki

@soloam
Copy link
Contributor Author

soloam commented Oct 13, 2021

Been using this for some time as a user plugin and works as expected! Is this relevant to flexget? Or can it be closed?

@github-actions
Copy link

This PR is stale because it has been open 150 days with no activity. Remove stale label or comment or this will be closed in 60 days.

@github-actions github-actions bot added the Stale label Apr 16, 2022
@ghost
Copy link

ghost commented Apr 18, 2022

any updates?

@github-actions github-actions bot removed the Stale label Apr 18, 2022
@github-actions
Copy link

This PR is stale because it has been open 150 days with no activity. Remove stale label or comment or this will be closed in 60 days.

@github-actions github-actions bot added the Stale label Sep 15, 2022
@paranoidi
Copy link
Member

This looks awesome! Sorry for delays.

def clean_symbols(self, text: str) -> str:
"""Replaces common symbols with spaces. Also normalize unicode strings in decomposed form.

Args:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reStructured would be preferable, although not as critical anymore with type hinting

if mycode:
lang = mycode.name
except babelfish.LanguageReverseError:
pass
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will hide errors, is this always desirable? Log exception / debug instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now I return a debug message


translations:
languages:
- "imdb_languages"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't quite follow, in some examples the "languages" key contains list of languages like "japanese" but here we have entry field names. If it has some intelligence/magic that allows both, I would much prefer to be explicit and have "language_fields" configuration key instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've split the fields, now we have languages and language_fields

@soloam
Copy link
Contributor Author

soloam commented Oct 14, 2022

Hello @paranoidi I've been out for some time, but now I'm back, I'll look into it and make the adjustments. The change on the language field (and yes it's "magic" to see if it's a language or a field), I don't like that change, but I understand the reason, I'll make the adjustment.

Tks

@github-actions
Copy link

This PR is stale because it has been open 150 days with no activity. Remove stale label or comment or this will be closed in 60 days.

@github-actions github-actions bot added the Stale label Mar 13, 2023
@soloam
Copy link
Contributor Author

soloam commented Mar 13, 2023

Sorry for the delay on this, had a lot over my hands lately! Going to get back on this ASAP.

@github-actions github-actions bot removed the Stale label Mar 14, 2023
@soloam
Copy link
Contributor Author

soloam commented May 23, 2023

I did the reviews sorry for the delay on this @paranoidi I've been very busy.

@github-actions
Copy link

This PR is stale because it has been open 150 days with no activity. Remove stale label or comment or this will be closed in 60 days.

@github-actions github-actions bot added the Stale label Oct 20, 2023
@soloam
Copy link
Contributor Author

soloam commented Oct 20, 2023

Not yet forgotten! I'll look at this as soon as possible

@github-actions github-actions bot removed the Stale label Oct 21, 2023
Copy link

This PR is stale because it has been open 150 days with no activity. Remove stale label or comment or this will be closed in 60 days.

@github-actions github-actions bot added the Stale label Mar 19, 2024
@soloam
Copy link
Contributor Author

soloam commented Mar 21, 2024

Not forgotten... Just low on time

@github-actions github-actions bot removed the Stale label Mar 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants