stash icon indicating copy to clipboard operation
stash copied to clipboard

[Feature] Add filter option for portrait vs landscape

Open sleetx opened this issue 3 years ago • 30 comments
trafficstars

Page views show both portrait and landscape oriented thumbnails, which impacts the spacing on the card view. Cards will expand to the size of the biggest thumbnail, even if all the others are a different orientation. The resulting spacing gaps affect are particularly noticeable on mobile browsers where less cards are shown at a time.

I would suggest adding a filter where people can choose to show only portrait or landscape oriented covers for scenes, galleries, movies, and images.

sleetx avatar Jun 16 '22 20:06 sleetx

I personally just add a Mobile tab to all portrait videos on my Stash. With that tag, I can choose to filter those videos.

cj12312021 avatar Jun 17 '22 19:06 cj12312021

What @Teda1 said. 🙂 As for me, I use CSS to make it so all cards have the same size regardless of aspect ratio

ALonelyJuicebox avatar Jun 17 '22 21:06 ALonelyJuicebox

@Teda1 @ALonelyJuicebox How do you two come up with the list of content to add a "Mobile" tag? Are you manually going through every portrait-oriented video and image as you add them? If so, that's simply not feasible for the majority of users especially the ones doing bulk imports. This filter would help automate their identification, and you wouldn't even need to use a tag.

I mentioned it being a useful filter to cut spacing on the mobile card view, but it's not exclusive to that use case. I could envision it being used for setting up a lightbox slideshow of all landscape images, or a playlist of portrait scenes, for example.

sleetx avatar Jun 17 '22 21:06 sleetx

For me, only specific studios offer portrait videos. So, selecting all videos from these studios and applying the Mobile tag is easy. If you are dealing with onlyfans content, it should be fairly straightforward to write a script that will add such a tag based on the video dimensions. To be clear, I'm not suggesting that building these filters into Stash is unnecessary. I'm simply providing solutions you could make use of today.

cj12312021 avatar Jun 17 '22 23:06 cj12312021

For me, only specific studios offer portrait videos. So, selecting all videos from these studios and applying the Mobile tag is easy. If you are dealing with onlyfans content, it should be fairly straightforward to write a script that will add such a tag based on the video dimensions. To be clear, I'm not suggesting that building these filters into Stash is unnecessary. I'm simply providing solutions you could make use of today.

Any suggestions how writing a script like that would look? For someone who does essentially no scripting other than batch commands to copy/paste stuff.

losthesodium avatar Aug 11 '22 21:08 losthesodium

Any suggestions how writing a script like that would look? For someone who does essentially no scripting other than batch commands to copy/paste stuff.

I'm going to be posting some really basic 'scraper' scripts that do things like 'add something to the title' 'add a "mobile" tag if the dimensions are more vertical' seems like a good example to add. So, I'll post one this weekend, as part of the batch I'll be posting.

The technique and level of python needed to grasp how it all works is pretty simple, so hopefully in the future, people will be able to easily figure out how to do similar "scripts" like this.

scruffynerf avatar Aug 11 '22 22:08 scruffynerf

Any suggestions how writing a script like that would look? For someone who does essentially no scripting other than batch commands to copy/paste stuff.

I'm going to be posting some really basic 'scraper' scripts that do things like 'add something to the title' 'add a "mobile" tag if the dimensions are more vertical' seems like a good example to add. So, I'll post one this weekend, as part of the batch I'll be posting.

The technique and level of python needed to grasp how it all works is pretty simple, so hopefully in the future, people will be able to easily figure out how to do similar "scripts" like this.

Awesome, thanks! Looking forward to seeing your script.. Lmao who would've thought my OCD for organizing my porn would be why I finally learn Python

losthesodium avatar Aug 12 '22 03:08 losthesodium

Ok, while I did a simple scraper that recognized mobile, then I decided tagging VR by looking at dimensions was worthwhile... and then I expanded to all aspect ratios... and then I realized that a scraper wasn't the right way to do this, despite it working, because a plugin that automatically tags items as they are scanned makes way way more sense. (It has a button to 'catchup' and tag all existing scenes as well)

https://github.com/scruffynerf/aspectratio

requires @stg-annon 's stashapi python module (install at a command line: pip install stashapp-tools) I'll submit it to the script repo soonish, but feedback/bug reports are welcome, since I'm still tweaking it a bit.

It's very configurable, the config.py that is created after the first run can be adjusted to change the ratio ranges, names, and so on.

I'll post the code for the simple scraper version for those who want to see how it worked before.

scruffynerf avatar Aug 18 '22 01:08 scruffynerf

Hey sorry for the annoying questions, but what exactly do I do with it? I've run pip install stashapp-tools, and put your .py file in the scrapers directory, but when I reload plugins nothing is there. Is there somewhere else I'm supposed to put it?

losthesodium avatar Aug 20 '22 18:08 losthesodium

Is there somewhere else I'm supposed to put it?

Copy everything (3 files, not include readme) to a new directory inside plugins (not scrapers)

Once it's added to plugins (refresh plugin button), it's listed in the tasks, for older scenes you want to tag. New added scenes get tagged automatically on being added.

scruffynerf avatar Aug 20 '22 22:08 scruffynerf

So this is my first plugin.. Where does the plugin folder go in relation to the main stash folder? In the same directory as the scrapers folder? Again, my bad for not understanding

losthesodium avatar Aug 21 '22 03:08 losthesodium

So this is my first plugin.. Where does the plugin folder go in relation to the main stash folder? In the same directory as the scrapers folder? Again, my bad for not understanding

No apologies needed.

By default, Stash looks for plugins in the main directory used otherwise (so same folder as scrapers). Weirdly it doesn't have a setting in the UI to adjust, but you can edit the location in the config.yml

scruffynerf avatar Aug 21 '22 03:08 scruffynerf

So this is my first plugin.. Where does the plugin folder go in relation to the main stash folder? In the same directory as the scrapers folder? Again, my bad for not understanding

No apologies needed.

By default, Stash looks for plugins in the main directory used otherwise (so same folder as scrapers). Weirdly it doesn't have a setting in the UI to adjust, but you can edit the location in the config.yml

Okay so I did that and reloaded plugins but still nothing. Any tips?

losthesodium avatar Aug 21 '22 03:08 losthesodium

Okay so I did that and reloaded plugins but still nothing. Any tips?

You should have 3 files: the .yml, that is the file used by Stash to recognize a scraper or plugin. It might be the only thing in some cases, since a lot can be in YAML. the .py main file (which in this case, is a python script run as directed by the yml) and for this plugin, a 2nd python file, which is the default configs (I copy them to config.py so you can edit that, and your local settings will never be overwritten so long as you don't remove that file.)

If you are on the plugin setting page, and you don't see the plugin, check the logs. If no log entries, likely the .yml isn't named correctly. How did you download it? Does it have a .txt ending on the end? (some people get that)

Downloading a full zip of a github repo is the safest non-geeky way to install stuff: on the main github page, click the green CODE button, then click "download zip"... opening the zip in all modern systems will open the zip into a folder (or let you extract it), and you can be sure the files are correctly named and properly downloaded. Move them to the right place.

Not sure what else to tell you.

scruffynerf avatar Aug 21 '22 03:08 scruffynerf

I think I figured it out right after you sent that.. Despite the fact the all my stash stuff is stored on my D drive according to the web interface and the config file, it will only read plugins if they are in the username/.stash/plugins directory on my C drive.. Everything else was correct, but once I put it in the C drive and reloaded plugins it popped right up. Gonna give it a first run now!

losthesodium avatar Aug 21 '22 03:08 losthesodium

Where's the catchup button? I have about 16k scenes for it to run through

losthesodium avatar Aug 21 '22 03:08 losthesodium

Where's the catchup button? I have about 16k scenes for it to run through

On the main settings page, in the task list

scruffynerf avatar Aug 21 '22 03:08 scruffynerf

Omg that's so dope.. I found it. It's running now

losthesodium avatar Aug 21 '22 03:08 losthesodium

It ran, but I don't see any additional tags.

losthesodium avatar Aug 21 '22 03:08 losthesodium

It ran, but I don't see any additional tags.

check the logs... you might need to select 'debug'... it's likely working in the background now.

scruffynerf avatar Aug 21 '22 03:08 scruffynerf

It's an error with my python install according to the logs.. eye roll.. Digging into that now..

losthesodium avatar Aug 21 '22 03:08 losthesodium

It's an error with my python install according to the logs.. eye roll.. Digging into that now..

let me know if I can improve setup instructions (well, from zero, anything is an improvement) And welcome to the beta testers. (best GLADOS impression) If you solve this, there will be cake.

scruffynerf avatar Aug 21 '22 03:08 scruffynerf

I'm getting a "\.stash\plugins\Aspect Ratio Plugin\python3: file does not exist error."

losthesodium avatar Aug 21 '22 03:08 losthesodium

ah, change the aspect_ratio.yml to say python instead of python3 I've changed that in the .yml for everyone, just in case.

scruffynerf avatar Aug 21 '22 04:08 scruffynerf

"Error running plugin task: error running plugin: exec: "C:\Users\MYNAME\.stash\plugins\Aspect Ratio\C:\Users\MYNAME\.stash\plugins\Aspect Ratio\C:\Users\MYNAME\.stash\plugins\Aspect Ratio\C:\Users\MYNAME\.stash\plugins\Aspect Ratio\C:\Users\MYNAME\.stash\plugins\Aspect Ratio\C:\Users\MYNAME\.stash\plugins\Aspect Ratio\python3": file does not exist "

That's the log entry everytime I click the catchup button.

losthesodium avatar Aug 21 '22 04:08 losthesodium

"22-08-21 00:07:42 Error Plugin returned error: exit status 1 2022-08-21 00:07:42 Error [Plugin / Aspect Ratio tagger] NameError: name 'StashInterface' is not defined 2022-08-21 00:07:42 Error [Plugin / Aspect Ratio tagger] stash = StashInterface(FRAGMENT_SERVER) 2022-08-21 00:07:42 Error [Plugin / Aspect Ratio tagger] File "C:\Users\MYNAME.stash\plugins\Aspect Ratio\aspect_ratio.py", line 122, in main 2022-08-21 00:07:42 Error [Plugin / Aspect Ratio tagger] main() 2022-08-21 00:07:42 Error [Plugin / Aspect Ratio tagger] File "C:\Users\MYNAME.stash\plugins\Aspect Ratio\aspect_ratio.py", line 151, in 2022-08-21 00:07:42 Error [Plugin / Aspect Ratio tagger] Traceback (most recent call last): 2022-08-21 00:07:42 Error Plugin returned error: exit status 1 2022-08-21 00:07:42 Error [Plugin / Aspect Ratio tagger] NameError: name 'StashInterface' is not defined 2022-08-21 00:07:42 Error [Plugin / Aspect Ratio tagger] stash = StashInterface(FRAGMENT_SERVER) 2022-08-21 00:07:42 Error [Plugin / Aspect Ratio tagger] File "C:\Users\MYNAME.stash\plugins\Aspect Ratio\aspect_ratio.py", line 122, in main 2022-08-21 00:07:42 Error [Plugin / Aspect Ratio tagger] main() 2022-08-21 00:07:42 Error [Plugin / Aspect Ratio tagger] File "C:\Users\MYNAME.stash\plugins\Aspect Ratio\aspect_ratio.py", line 151, in 2022-08-21 00:07:42 Error [Plugin / Aspect Ratio tagger] Traceback (most recent call last): 2022-08-21 00:07:42 Error [Plugin / Aspect Ratio tagger] You need to install the stashapp-tools (stashapi) python module. (CLI: pip install stashapp-tools)"

losthesodium avatar Aug 21 '22 04:08 losthesodium

But whenever I try to install the stashapp-tools it says requirement already satisfied.

losthesodium avatar Aug 21 '22 04:08 losthesodium

different pythons are being run. Hard to tell you exactly how to fix this... you have at least two different python installs/ .exes

scruffynerf avatar Aug 21 '22 04:08 scruffynerf

Uninstalling and reinstalling python now

losthesodium avatar Aug 21 '22 04:08 losthesodium

Okay so now after a fresh python install:

Error running plugin task: error running plugin: exec: "C:\Users\MYNAME\.stash\plugins\Aspect Ratio\python": file does not exist Error loading plugin C:\Users\MYNAME.stash\plugins\stashapp-tools-main.github\workflows\upload-to-pip.yml: yaml: unmarshal errors: line 4: field on not found in type plugin.Config line 11: field jobs not found in type plugin.Config Error loading plugin C:\Users\MYNAME.stash\plugins\stashapp-tools-main.github\workflows\sync-submodules.yml: yaml: unmarshal errors: line 3: field on not found in type plugin.Config line 7: field jobs not found in type plugin.Config Error loading plugin C:\Users\MYNAME.stash\plugins\stashapp-tools-main.github\workflows\upload-to-pip.yml: yaml: unmarshal errors: line 4: field on not found in type plugin.Config line 11: field jobs not found in type plugin.Config Error loading plugin C:\Users\MYNAME.stash\plugins\stashapp-tools-main.github\workflows\sync-submodules.yml: yaml: unmarshal errors: line 3: field on not found in type plugin.Config line 7: field jobs not found in type plugin.Config

But also I get it, it works for you so I completely understand not feeling like getting into it. I do appreciate the help you've given me so far though!

losthesodium avatar Aug 21 '22 04:08 losthesodium