curtwagner1984 / YAPO

Yapo - Yet Another Porn Organizer
GNU General Public License v3.0
48 stars 10 forks source link

[Feature Request] Add aliases function to scene tags / websites #30

Closed sjclayton closed 2 months ago

sjclayton commented 8 years ago

I think it would be complimentary to add an alias function to the scene tags (like how Tag synonyms work on Empornium), where in if you have the tag 'Blowjob' in the database you could then set the alias 'BJ' for it for example, so that when scenes are being parsed they will still get tagged with 'Blowjob' even though they do not contain it in their filename or path.

Another example, in the case of a website - you have the site 'Exploited College Girls' in the database and a potential alias for it could be 'ECG', that way if when running 'Tag All Scenes' it came across "ecg" in the file name it would automatically recognize that it belongs to that website.

curtwagner1984 commented 8 years ago

Yes I thought about that, but did not implement that yet because I thought of making some sort of tag hierarchy for example Femdom is a a part of BDSM so if you tag something with femdom it should automatically tag it with bdsm.

Also, actor tags should be in scene tags so when you tag a scene with an actor with blond hair and blue eyes the scene would be tagged as well.

Also, also websites many times have similar themes so I thought they should have tags also. For example Twistys is always 'solo' and 'softcore' so when something is tagged with that site the scenes should be automatically tagged with these tags.

This isn't directly connected to what you said, but these are general tag improvements that need to happen.

curtwagner1984 commented 8 years ago

Should work now ...

sjclayton commented 8 years ago

@curtwagner1984 After pulling when I go to run makemigrations...

when I choose option 1 and input datetime.datetime.now() after pressing enter it just keeps asking me to choose options over and over.... everytime I try option 1 with that input, it doesn't take it...

I really hope my database isn't messed up somehow that's preventing this from working.... it shouldn't be...

(YAPOenv) shaun@athena ~/YAPOenv/YAPO $ python manage.py makemigrations
Static files dir is: /home/shaun/YAPOenv/YAPO/videos/static
Media files dir is: /home/shaun/YAPOenv/YAPO/videos/media
/usr/bin/smplayer
Last full scene tagging : 2016-08-31 14:20:47
System check identified some issues:

WARNINGS:
videos.Actor.actor_aliases: (fields.W340) null has no effect on ManyToManyField.
videos.Actor.actor_tags: (fields.W340) null has no effect on ManyToManyField.
videos.Folder.scenes: (fields.W340) null has no effect on ManyToManyField.
videos.Scene.actors: (fields.W340) null has no effect on ManyToManyField.
videos.Scene.scene_tags: (fields.W340) null has no effect on ManyToManyField.
videos.Scene.websites: (fields.W340) null has no effect on ManyToManyField.
videos.Website.scene_tags: (fields.W340) null has no effect on ManyToManyField.
You are trying to add a non-nullable field 'modified_date' to actor without a default; we can't do that (the database needs something to populate existing rows).
Please select a fix:
 1) Provide a one-off default now (will be set on all existing rows)
 2) Quit, and let me add a default in models.py
Select an option: 1
Please enter the default value now, as valid Python
The datetime and django.utils.timezone modules are available, so you can do e.g. timezone.now()
>>> datetime.datetime.now()
You are trying to add a non-nullable field 'modified_date' to actortag without a default; we can't do that (the database needs something to populate existing rows).
Please select a fix:
 1) Provide a one-off default now (will be set on all existing rows)
 2) Quit, and let me add a default in models.py
Select an option: 1
Please enter the default value now, as valid Python
The datetime and django.utils.timezone modules are available, so you can do e.g. timezone.now()
>>> datetime.datetime.now()
You are trying to add a non-nullable field 'modified_date' to folder without a default; we can't do that (the database needs something to populate existing rows).
Please select a fix:
 1) Provide a one-off default now (will be set on all existing rows)
 2) Quit, and let me add a default in models.py
Select an option: 
curtwagner1984 commented 8 years ago

@sjclayton It does take. There are fields added to most of the models so you need to input it about 7 or 8 times.

sjclayton commented 8 years ago

@curtwagner1984 Ahhhh fuck fuck fuck..... okay.... I was wondering if maybe that was the case...

Thanks!!!

EDIT: Got it now.... Worked!! =D

sjclayton commented 8 years ago

@curtwagner1984 Can you add multiple scene tag aliases, like you can with websites or...?

curtwagner1984 commented 8 years ago

@sjclayton Yep... I forgot to add a tooltip?

sjclayton commented 8 years ago

@curtwagner1984 Yeah, I figured that might have been the case.... I can fix it if you want?

Also on anything requiring comma separated values... strip should really be run... because a lot of people are used to putting in spaces after a comma in a list...

Eg: "BJ, Squirt, DP" not "BJ,Squirt,DP"

We shouldn't have to explicitly tell our users to not put in a space... not everyone pays attention =P

sjclayton commented 8 years ago

@curtwagner1984 I'm working on it now!! =D

sjclayton commented 8 years ago

@curtwagner1984 The tooltip was added for scene tag aliases (and the message revised) and code to prevent leading / trailing spaces in comma separated values was added in the lastest pull request.

Also I discovered an issue that needs some looking into...

Say for example, you have a website: 'Only.Teen.Blowjobs' and a parent scene tag 'Blowjob'.... files that match on 'Only.Teen.Blowjobs' for the website get tagged with it (like they should), but are not getting tagged with the scene tag 'Blowjob'.... This is a major issue, because there are lots of sites like that (ie. they have common tag names in their name), that are going to fuck up the tagging system by creating issues of files being not tagged with scene tags because of it...

Another perfect example is the site 1000 Facials... files that get that website '1000.Facials' tagged correctly will fail to get tagged with the scene tag 'Facial'

I know this has to do with the way the file name parser works.... I just don't know what can / has to be done in order to correct this issue.

curtwagner1984 commented 8 years ago

code to prevent leading / trailing spaces in comma separated values was added in the lastest pull request

What if someone wants an alias to be padded with spaces?

Also I discovered an issue that needs some looking into...

Yes I'm aware of this. I think what should happen is that websites and actortags should contain scentags inside of them. EX: 'Only.Teen.Blowjobs' will be tagged with 'Teen' and 'Blowjob' so every time a scene is tagged with this site, it is automatically tagged with both 'teen', and 'blowjob'. The same is true with actor tags, If a scene is tagged with an actor with an actor tag: "eye.color.blue" the scene should be tagged with the scene tag "eye.color.blue".

I'm just not sure how to implement this.

sjclayton commented 8 years ago

@curtwagner1984

What if someone wants an alias to be padded with spaces?

Can you give me an example of why this would really be useful? Like, I am not trying to piss on your breakfast, really... =P by adding code to prevent something that someone may actually want to do...

I just figured that because you didn't really respond to what I mentioned in my message ^^ about it, and gave a thumbs up that it was all good...

curtwagner1984 commented 8 years ago

@sjclayton I can't really think of any use for it actually. I thought about instances when you don't to match a substring of a bigger word. EX: you want to match 'phone' but you don't want to match 'cell-phone' or 'headphone' or 'telephone' so you pad the word you want with spaces phone and it will only match this word if it's alone in the sentence and not a substring. But now that I think about it, I can't name an example where this can be applicable to Yapo.

sjclayton commented 8 years ago

@curtwagner1984 Yeah, I totally get your point about it... I just couldn't figure out how it would be applicable / useful to what we are doing...

So are we in agreement then, that in all future cases where comma separated values (CSV) are required that we are going to strip the whitespace from them then?

It's one less thing for users to have to pay attention to whether they need to do it or not (adding or leaving out spaces)... that way regardless of what they do, it works the same way.

curtwagner1984 commented 8 years ago

@sjclayton Why not... Or at least until we find a case where is detrimental to the war effort.

curtwagner1984 commented 8 years ago

@sjclayton Ok so I found a case where it is detrimental to the war effort. If you give the tag 'Interracial' the alias 'IR' it will mistakenly pick up anything with the word 'girl' in it.

Also, I've added 'scene_tags' to websites and actor_tags. So now when you add a website to a scene it will tag this scene with the tags from the website. Also works with actors although actors have only 'scene_tags' that correspond with their actor_tags.

This requires a database update, and also on startup it should go over all the actor_tags and create scene_tags for them.

To tag scenes with tags from actor_tags retroactively one needs to 'tag_all_scenes' with 'ignore last lookup' flag.

Also, mainstreamed the adding and removing of tags a little and added more printouts to them.

sjclayton commented 8 years ago

@curtwagner1984 Hey!, I created a #slack team account for YAPO -- you should have received an invite to it (check your gmail). I think it would be better to use it for general conversations about issues here and YAPO related discussions in general (it can be integrated with GitHub if you once you're on it and I make you an admin, which I will... and you do 'Add an app or custom integration' in the #development channel and add your GitHub, we'll talk about it more once you're in the group)... that way long conversations about things will not take up endless space here... and the Issues tab can be reserved for posting only messages about when issues are resolved, and anything specifically applicable to the resolution.... Also we may have a couple other people contributing to YAPO as well soon (part of why I set up the account in the first place), so it will be an overall much nicer method of communication.

as far as the database update, after pulling the latest changes.... running makemigrations gives me this...

Actor Pepper Xo thumb path is: media/actor/105/profile/profile.jpg 
 and it should be media/actor/105/profile/profile.jpg
False
Actor Ophelia Rain thumb path is: media/actor/106/profile/profile.jpg 
 and it should be media/actor/106/profile/profile.jpg
False
Traceback (most recent call last):
  File "/home/shaun/YAPOenv/lib/python3.4/site-packages/django/db/backends/utils.py", line 64, in execute
    return self.cursor.execute(sql, params)
  File "/home/shaun/YAPOenv/lib/python3.4/site-packages/django/db/backends/sqlite3/base.py", line 323, in execute
    return Database.Cursor.execute(self, query, params)
sqlite3.OperationalError: no such table: videos_actortag_scene_tags

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "manage.py", line 21, in <module>
    execute_from_command_line(sys.argv)
  File "/home/shaun/YAPOenv/lib/python3.4/site-packages/django/core/management/__init__.py", line 353, in execute_from_command_line
    utility.execute()
  File "/home/shaun/YAPOenv/lib/python3.4/site-packages/django/core/management/__init__.py", line 345, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/home/shaun/YAPOenv/lib/python3.4/site-packages/django/core/management/base.py", line 348, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/home/shaun/YAPOenv/lib/python3.4/site-packages/django/core/management/base.py", line 398, in execute
    self.check()
  File "/home/shaun/YAPOenv/lib/python3.4/site-packages/django/core/management/base.py", line 426, in check
    include_deployment_checks=include_deployment_checks,
  File "/home/shaun/YAPOenv/lib/python3.4/site-packages/django/core/checks/registry.py", line 75, in run_checks
    new_errors = check(app_configs=app_configs)
  File "/home/shaun/YAPOenv/lib/python3.4/site-packages/django/core/checks/urls.py", line 13, in check_url_config
    return check_resolver(resolver)
  File "/home/shaun/YAPOenv/lib/python3.4/site-packages/django/core/checks/urls.py", line 23, in check_resolver
    for pattern in resolver.url_patterns:
  File "/home/shaun/YAPOenv/lib/python3.4/site-packages/django/utils/functional.py", line 33, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/home/shaun/YAPOenv/lib/python3.4/site-packages/django/core/urlresolvers.py", line 417, in url_patterns
    patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
  File "/home/shaun/YAPOenv/lib/python3.4/site-packages/django/utils/functional.py", line 33, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/home/shaun/YAPOenv/lib/python3.4/site-packages/django/core/urlresolvers.py", line 410, in urlconf_module
    return import_module(self.urlconf_name)
  File "/home/shaun/YAPOenv/lib/python3.4/importlib/__init__.py", line 109, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 2254, in _gcd_import
  File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
  File "<frozen importlib._bootstrap>", line 2226, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 1200, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 1129, in _exec
  File "<frozen importlib._bootstrap>", line 1471, in exec_module
  File "<frozen importlib._bootstrap>", line 321, in _call_with_frames_removed
  File "/home/shaun/YAPOenv/YAPO/YAPO/urls.py", line 180, in <module>
    actorTag.scene_tags.add(scene_tag_to_add)
  File "/home/shaun/YAPOenv/lib/python3.4/site-packages/django/db/models/fields/related_descriptors.py", line 843, in add
    self._add_items(self.source_field_name, self.target_field_name, *objs)
  File "/home/shaun/YAPOenv/lib/python3.4/site-packages/django/db/models/fields/related_descriptors.py", line 988, in _add_items
    new_ids = new_ids - set(vals)
  File "/home/shaun/YAPOenv/lib/python3.4/site-packages/django/db/models/query.py", line 258, in __iter__
    self._fetch_all()
  File "/home/shaun/YAPOenv/lib/python3.4/site-packages/django/db/models/query.py", line 1074, in _fetch_all
    self._result_cache = list(self.iterator())
  File "/home/shaun/YAPOenv/lib/python3.4/site-packages/django/db/models/query.py", line 158, in __iter__
    for row in compiler.results_iter():
  File "/home/shaun/YAPOenv/lib/python3.4/site-packages/django/db/models/sql/compiler.py", line 802, in results_iter
    results = self.execute_sql(MULTI)
  File "/home/shaun/YAPOenv/lib/python3.4/site-packages/django/db/models/sql/compiler.py", line 848, in execute_sql
    cursor.execute(sql, params)
  File "/home/shaun/YAPOenv/lib/python3.4/site-packages/django/db/backends/utils.py", line 79, in execute
    return super(CursorDebugWrapper, self).execute(sql, params)
  File "/home/shaun/YAPOenv/lib/python3.4/site-packages/django/db/backends/utils.py", line 64, in execute
    return self.cursor.execute(sql, params)
  File "/home/shaun/YAPOenv/lib/python3.4/site-packages/django/db/utils.py", line 95, in __exit__
    six.reraise(dj_exc_type, dj_exc_value, traceback)
  File "/home/shaun/YAPOenv/lib/python3.4/site-packages/django/utils/six.py", line 685, in reraise
    raise value.with_traceback(tb)
  File "/home/shaun/YAPOenv/lib/python3.4/site-packages/django/db/backends/utils.py", line 64, in execute
    return self.cursor.execute(sql, params)
  File "/home/shaun/YAPOenv/lib/python3.4/site-packages/django/db/backends/sqlite3/base.py", line 323, in execute
    return Database.Cursor.execute(self, query, params)
django.db.utils.OperationalError: no such table: videos_actortag_scene_tags
curtwagner1984 commented 8 years ago

@sjclayton Did you do migrate after makemigrations ?

sjclayton commented 8 years ago

@curtwagner1984 I didn't even get to doing migrate... it did that (errored out) on makemigrations

curtwagner1984 commented 8 years ago

@sjclayton Well, Crap! For some reason it executes code that is in urls.py when manage.py is executed... and this code itself needs the migrations to be complete to work. I need to figure out where to put it so it will execute on server startup specifically and not just when manage.py is executed...