YouROK / TorrServer

Torrent stream server
GNU General Public License v3.0
1.35k stars 179 forks source link

Add category associated to each torrent #325

Closed cocool97 closed 2 months ago

cocool97 commented 7 months ago

Closes #230

Adds a category associated to each torrent, and displayed in Web UI.

Next step will be to add a sort by such categories in Android app. This choice could be configurable as preferences (either by name, by added date or by category)

Let me know what you think of it, I'll improve code on your comments !

YouROK commented 5 months ago

Исправь пожалуйста конфликты и напиши мне в телегу. А то сюда редко захожу

cocool97 commented 5 months ago

Yes I need to solve merge conflicts. Will keep you up to date about it.

cocool97 commented 3 months ago

@YouROK Everything is now ready for review.

Categories are defined in their own file, you can change names or add easily.

Let me know if there is something you want me to change ! If you approve this would be nice to add such things in Android App, I'll open an issue to add it (I can't do it myself, I've never done it).

cocool97 commented 3 months ago

@tsynik Is this feature OK for you ?

tsynik commented 3 months ago

@tsynik Is this feature OK for you ?

I'll check web later. before, i was not happy with "Unknown" category by default

cocool97 commented 3 months ago

What would you prefer as default category ? Force user to set one ? Are available choices OK or is it something we can improve ?

tsynik commented 2 months ago

Here is not consistent web UI at torrent titles and inside edit after adding this changes:

cat1 cat2

Also, it's not clear what happens when user click on category icons in left bar and which category is currently shown. I think it's better not to show Category title at all if it's not set, and write it instead "CATEGORY" text if it exists, maybe as color label (MOVIES) (TV) (MUSIC) etc in top right corner of the card. Also, at my point Other and Unknown is overhead, just Other is enough. Also, category labels are not localized in UI.

tsynik commented 2 months ago

What would you prefer as default category ? Force user to set one ? Are available choices OK or is it something we can improve ?

I think it's better to not set any as "Unknown" if not provided by script or user, and unset it with None option from category dropdown on edit card. Also, as it's just any string, best way to store translated categories for Movies, TV, Music and add user an option to set any with Other, and populate it from DB to choice list ;-)

emptycat

also, i think we need to hide this category label in detailed description at all to torrents where category is not set. and there is some bug as previously set category disappeared after opening torrent detailed description too.

This is console warning on opening details:

console warning
cocool97 commented 2 months ago

This is a good point, we could not display it at all if nothing is provided. This will be the default for every previously added torrent. Every new torrent added will have at least a category.

For the difference between "Other" and "Unknown", it allowed to differentiate between a torrent that has no known category "Other" (such a missing category could be added afterwards), and a torrent that has not been provided with a category "Unknown". If we let category field empty by default if user selected nothing we could merge both categories into "Other"

cocool97 commented 2 months ago

If we let user enter its own categories, we won't be able to filter it in Leftbar to display only some torrents depending on selected category... I would like to keep this option, especially in Android application for users having a huge torrent list of many kinds)

tsynik commented 2 months ago

If we let user enter its own categories, we won't be able to filter it in Leftbar to display only some torrents depending on selected category... I would like to keep this option, especially in Android application for users having a huge torrent list of many kinds)

We can have three main categories in leftbar, and extend it to any user defined ones with Other. Now I changed writed to DB categories values to lowercase key values from TORRENT_CATEGORIES, and they are consistent between locales and not name-dependent anymore and properly filtered from main bar too on any locale. We can improve this logic for user defined categories too.

tsynik commented 2 months ago

For the difference between "Other" and "Unknown", it allowed to differentiate between a torrent that has no known category "Other" (such a missing category could be added afterwards), and a torrent that has not been provided with a category "Unknown". If we let category field empty by default if user selected nothing we could merge both categories into "Other"

There will be no backward compatibility with previously added torrents. I think it's better leave it empty and not assign it at all. All thousand previously added torrents don't have any and it's okay. Some people don't want to change this behavior.

cocool97 commented 2 months ago

I fixed the issue you had with categories not displayed and also removed display for categories if not set in c8e02deefd113d16af2ccdb2acadc18573219764.

I still have the console.error but cannot figure out why it still happens

cocool97 commented 2 months ago

Ok for me for the leftbar. Will it be consistent in android app ?

tsynik commented 2 months ago

Also, I think we need add None here as last point and remove previously defined category by user request too

remove-cat
cocool97 commented 2 months ago

Hmm not sure if this would be something useful. Why would someone want to uncategorize a torrent ?

I found a way to implement it without many modifications, so let's finally add it. Default category is now "", and a new leftbar category has been added to filter for uncategorized torrents

cocool97 commented 2 months ago

Everything is OK for me, what still needs to be done before merging ?