Import PB link + subtitles for Streams
complete
Amrayu78
Starting a new canny for this since we're done with the main core logic.
I'd like to empower Contributors and Editors by giving them the option to import the PB link + their subtitles.
A few things to consider:
- Downloaded hash should be removed from the file if downloaded by the import; we don't want the hash to show up in the stream
- Add subtitle language within the subtitle file (example: Re/Member: THE LAST NIGHT 2025 1080p AMZN WEB-DL DDP5.1 H.264-NSBC.en.srt) "en" here is for English.
Let me know if this is possible.
Thanks!
Amrayu78
marked this post as
complete
Amrayu78
Max Romanchenko New enhancement lol
Max Romanchenko
Amrayu78 Thank you for the new task 🙂
That sounds doable, though there might be some nuances with renaming since files could be named differently (hopefully not).
Could you please provide a real example of a Subtitle project so I can test it on an actual case?
Also, a couple of questions:
- Our PB Link is stored in episodes (for Dramas and Specials). How should we handle such cases? Or is the PB Link always the same for all episodes?
- The final step of the import will be the PB Link that needs to be added to the Stream link, correct? (Meaning the Stream link will be the same as the PB Link of the related title, right?) Does this imported link need to have a Title?
Amrayu78
Max Romanchenko Here's a subtitle project that you can test with:
- The PB links... most times there's just 1 link or 2 links (for a different version), but the rest of the episodes will have the same link as episode 1. I manually go in and update this everyday. It's just easier to have the same link. So always scan the first episode, it'll have either 1 or 2 links, if that episode contains 2 links, allow the user to import the one that syncs with their subtitles (you can show the filenames).
- Yes. Imported link title? Do you mean the Stream link title? I think the user can fill that out if needed.
On a separate but connected note, I'm updating PB links everyday with the same link for every episode. It's a bit of a pain, can we make it easier?
Perhaps, when a title has 1 episode linked already, if I add a new episode, the link is pre-populated from the link in episode 1?
Thanks!
Max Romanchenko
Amrayu78 Thank you for the clarifications.
Regarding the prepopulate, of course I will implement it so that it's easier for you when adding a new episode.
About "So always scan the first episode, it'll have either 1 or 2 links, if that episode contains 2 links, allow the user to import the one that syncs with their subtitles (you can show the filenames)." I'm a bit confused, sorry. Do I understand correctly that if an episode has 2 links, the user should be shown the list of files located in both of those folders (links), and then choose which folder to import? So this would be an intermediate step where the user selects the correct folder to import, right? Or did I misunderstand?
Perhaps even if there is only 1 link in the episode, it might still be useful to show the list of files in the PB Link before import, so the user can see exactly where the subtitles will go.
Amrayu78
Max Romanchenko Thanks!
Yes, you understood correctly. Here's an example of such a case: https://drama-otaku.com/drama/ramune-monkey/#episodes
One link is for files from FOD the other is from NF.
Yes, it would be useful to still show a list of files in the PB link before import.
Max Romanchenko
Amrayu78 Thank you, I'm working on this.
Max Romanchenko
Amrayu78 Ok, I believe all steps are completed:
- The hash is not added to subtitles.
- Language mapping works as follows (suffix added at the end of the filename):
english → en
japanese → jp
spanish-spain → es
spanish-latam → es.la
On the final step, after a successful import, the sharing URL of the folder is inserted into the corresponding Stream Link field (but not saved automatically).
I added a notification: "Import completed! Don't forget to click the Save button to keep your changes."
I intentionally did not implement autosave to avoid confusion. Since we are inside the edit form, saving is always expected via the Save button. Also, the sharing link may already be added to the Stream Link, so the last step is simply to save the project, then the Stream Link chosen from the related title will appear as the player.
Of course, this needs careful testing and there may be edge cases. For example, I already excluded zip files from upload since they don't make sense for stream links. Also, currently duplicates can be created if a subtitle with the same name already exists in the sharing folder (e.g. if import was run before or the file already exists). Probably in such cases the file should be skipped and not uploaded again to Gofile/Pixeldrain.
_____
Regarding the episode add form, I implemented prefilling of PB links from the first episode (works with one or multiple links).
Amrayu78
Max Romanchenko Thanks for implementing this. I tested it today and noticed some bugs.
Imported this link: https://drama-otaku.com/subtitle-project/punch-drunk-woman-2/
- Link was properly copied. However I see the import button still available after the Success screen shows, this should be grayed out?
- There's a total of 4 subtitles, only 2 of which were duplicated to the gofile folder, episodes 3 and 4.
Below are the files that were created:
- Punch Drunk Woman E03-HULU-WEB-DL-1080p-H264-AAC-DramaClub.en.ass
- Punch Drunk Woman E04-HULU-WEB-DL-1080p-H264-AAC-DramaClub.en.ass
- punch-ep03.cleaned.en.ass
- punch-ep04.cleaned.en.ass
Episodes 1 and 2 are missing and it seems episode 3 and 4 were duplicated.
- The Import link was duplicated initially. It showed 2 streams with the same number of episodes.
- The Stream tag doesn't show after saving for the above scenario.
Max Romanchenko
Amrayu78 Thank you for testing this!
- To reproduce the issue I need to delete the imported files from Gofile, so I need to understand how the folder Punch Drunk Woman [HULU] looked before the import.
Do I understand correctly that these files were imported to Gofile:
- Punch Drunk Woman E03-HULU-WEB-DL-1080p-H264-AAC-DramaClub.en.ass
- punch-ep03.cleaned.en.ass
- Punch Drunk Woman E04-HULU-WEB-DL-1080p-H264-AAC-DramaClub.en.ass
- punch-ep04.cleaned.en.ass
And then you manually uploaded the subtitles for the first and second episodes:
- Punch Drunk Woman E01-HULU-WEB-DL-1080p-H264-AAC-DramaClub.en.ass
- Punch Drunk Woman E02-HULU-WEB-DL-1080p-H264-AAC-DramaClub.en.ass
I plan to remove these files from the folder after confirming with you.
- Could you please clarify the steps to reproduce the bug? Was the stream link from the related title https://gofile.io/d/link1 already added earlier to the subtitle project? Did you then click "Add link," import subtitles into this sharing link, save, and end up with two identical stream links https://gofile.io/d/link1 in the Stream Links tab?
If so, the form does not check for duplicate links when saving. In that case, you don't need to create a new link, instead, you should click Import PB Link next to the existing link https://gofile.io/d/link1.
Perhaps I misunderstood the problem. If possible, could you describe it in more detail or share a screenshot?
Amrayu78
Max Romanchenko
- Sure go ahead and delete.
- Yes, those are the files that the import created
- Yes, I manually uploaded the remaining files since the import missed those
- No, it wasn't linked, I just clicked import then hit save after that. I think there is one confusing thing about the UI for this. I think because the first instance of the Stream Link not collapsed, I clicked the import from the "add stream link" field. Essentially, you can't tell if you're supposed to click the already un-collapsed stream link to hit import. I think the user's gut instinct is to click "Add Stream Link" so it adds 2 links as a result. Maybe we should collapse the first instance if one doesn't exist already.
Max Romanchenko
Amrayu78
I've fixed all the issues. I also added a list of uploaded files (see screenshot), which I think will be useful.
Imported subtitles:
✓ Punch Drunk Woman E04-HULU-WEB-DL-1080p-H264-AAC-DramaClub.en.ass
✓ Punch Drunk Woman E03-HULU-WEB-DL-1080p-H264-AAC-DramaClub.en.ass
✓ Punch Drunk Woman E02-HULU-WEB-DL-1080p-H264-AAC-DramaClub.en.ass
✓ Punch Drunk Woman E01-HULU-WEB-DL-1080p-H264-AAC-DramaClub.en.ass
I also added protection against overwriting files (if a file already exists in the folder it is skipped, and this is shown in the final import notification).
You were right about Add Stream Link, I improved this behavior. Now if no data exists the first element is always expanded, and I prevented saving empty links. This improvement is applied here and in other places such as Add Cast, Add Crew, etc.
Please test again.
Amrayu78
Max Romanchenko Great! Let me test this today.
Amrayu78
Max Romanchenko I've tested this again and there's still some major bugs.
- After clicking the import button, saving, the stream links are indeed duplicated. See screenshot.
- Subtitles are not being renamed correctly--episode numbers are incorrect, so they do not sync with the videos. You can check here: https://drama-otaku.com/subtitle-project/fukukaichou-no-omona-oshigoto-1080p-dramaclub/#stream-links
This fansubber marks the subtitles in the beginning with the episode number and the video/audio doesn't sync with the subtitles. It looks like the subtitles may be in reverse order? Ep5 = Ep1, Ep4 = Ep2, etc.
You can test with the above Subtitle Project.
Max Romanchenko
Amrayu78 Thank you for another round of testing, and apologies for the issues.
I made some optimizations to remove CSS dependencies in the edit form so it works more smoothly after testing the links, and that's why I overlooked bug #1.
I want to confirm that this is now fully fixed, the link will no longer be inserted twice.
Regarding bug #2, you were right about the incorrect order. I removed the wrong subtitles from the folder, corrected the logic, and reuploaded them. I've now deleted the subtitles again so you can retest this from scratch.
Please test again.
Amrayu78
Max Romanchenko Deleted the old subtitles from gofile and re-imported. I think it's working great now. I will test with one other project soon.
But one thing I want to add. Can we trigger this subtitle import whenever the subtitle provider uploads a subtitle file to the subtitle project page?
- If a subtitle project has a stream link with my gofile account and a user uploads a subtitle, auto-imports to gofile link if stream link exists.
That way the user only imports once and keeps uploading to the subtitle project and it auto-updates the files to gofile.
We can add a checkbox and have it auto-ticked to auto-import. Let me know if you think this is a good idea or not. I'm trying to automate as much of the process as possible.
Max Romanchenko
Amrayu78 I think automation is always a good idea, anything that helps simplify routine should be implemented. In this case I carefully added extra functionality that doesn't affect the site's performance. Instead of a checkbox I used a radio button, the field stores nothing by default (with Enabled as the default option, so the database isn't cluttered). Only the Disabled option stores a value of 1. Then, on save, the background logic runs.
It works both on the frontend and backend.
Please test again.
Amrayu78
Max Romanchenko Thanks for implementing this. I will wait for the fansubbers to upload to see if this works in action.
One final thing I would like implemented that is related to this.
Two scenarios but both are related.
Scenario 1:
- Fansubber has hardsubbed their files
- They've uploaded to their gofile
- They try to link it on DO via Subtitle Projects > Stream Links, doesn't work of course.
- Can we add an import feature from an externally owned gofile to the Drama-Otaku gofile/pixeldrain? I'm currently doing this manually for a few fansubbers.
Scenario 2:
- Fansubber has RAW files (usually its the complete batch/series) that DO doesn't have
- Fansubbers makes request to me to import to DO's gofile
- I import it, move it to the proper Year directory in gofile, make the link public, copy/paste the link into the relevant Drama-Otaku page via the Episodes tab.
- If the title has 10 episodes, I add 10 new episodes to the tab.
- Can we automate this somehow? Or automate parts of this process?
Max Romanchenko
Amrayu78 Thanks for the feedback!
Scenario 1 - Tested this and it doesn't give the desired result. Gofile doesn't allow direct download links for files from external accounts without Premium. On top of that, adding an "import from external gofile" feature would likely create more confusion than it solves (it's a different flow from how the current Import PB Link works).
Better to keep this one manual.
Scenario 2 - The Gofile upload part stays manual, but there's already an "Add Episode" form on the Drama/Special page. Could add a "Bulk Add Episodes" option next to it for cases like this (just enter the number of episodes and they all get created at once with correct numbering).
Would that work?
Amrayu78
Max Romanchenko:
Scenario 1: got it. Lets keep this manual.
Scenario 2: yes, this would work and at least save everyone some time.
Max Romanchenko
Amrayu78 To avoid creating a new form, which would not make sense, I have added a new checkbox called "Bulk Add" to the current form. When selected, it reveals a new field called "Episode Range" (up to 50 episodes for performance reasons, which I believe should be sufficient).
The following fields are copied from what you fill in the form into the other episodes (up to 50) to save you from manual repetitive work:
episode number, PB links, and duration.
I tested this on a test drama and it works. Please check it.
Amrayu78
Max Romanchenko This is working as expected! Thanks. We can consider this task complete. thank you.