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
Mass Tag Edit from CSV (or similar) #319
Comments
For me it always worked instantly when i setup a new alias oO |
Yeah. |
But I really only noticed that it didn't change on the more common tags, like the ones with counts over 100+ |
ugh, my shimmie (closed and only people who i invite can join; might make that an extension someday~) doesnt have any tag which occurs more than 80 times so i can't test that myself |
It's not an exact number, it's just a rough estimate. It could have been less, could have been more. |
Theoretically speaking, adding something like $aae = new AddAliasEvent($pair['oldtag'], $pair['newtag']);
send_event($aae); after line 144 of ext/alias_editor/main.php should retag on every new pair. And for the already added aliases you need to add a button or something like that going over all images =/ |
Could the fact that the CSV I uploaded contained just over 300 new aliases be an issue as to why things didn't re-tag? |
Well I did a mistake above, don't use the code. And nope, as far as I can tell when adding a single alias, it updates the tags and saves the pair into the DB. When uploadig a CSV, it just saves the pairs in the DB and doesn't change anything. |
Ah I see. So this is (technically) a bug then? |
Kinda, but i guess its more about the max_execution time of php which could turn out to be a problem if its set too strict and there are too many images already |
@HungryFeline I'm not sure if you mis-phrased or if I misread but did you mean that when a CSV alias list gets uploaded, it doesn't do anything to existing tags like as if I were to add the alias manually? And to either of you, could you suggest a workaround? |
When adding with a CSV only new images will get the tag replaced. I made something working but don't know if it's a dirty hack or fit for the main repo so I'm just pasting it here: File ext/alias_editor/main.php replace $pair = array("oldtag" => $parts[0], "newtag" => $parts[1]);
if(!$database->get_row("SELECT * FROM aliases WHERE oldtag=:oldtag AND lower(newtag)=lower(:newtag)", $pair)){
if(!$database->get_row("SELECT * FROM aliases WHERE oldtag=:newtag", array("newtag" => $pair['newtag']))){
$database->execute("INSERT INTO aliases(oldtag, newtag) VALUES(:oldtag, :newtag)", $pair);
}
} with $aae = new AddAliasEvent($parts[0], $parts[1]);
send_event($aae); I tagged 2 different images, one with "test1", one with "test2" and added a CSV with the value
and it worked. That's all testing done. Don't expect too much from the code :D |
Also note that this could've some unexpected side-effects when an error occurs. At least the import would be canceled. |
Well I always back up my database before attempting any of this kind of stuff anyway :P |
with how fast things are going right now it kinda feels like we're in some kinda chatroom :> iLike |
It's because we don't have better things to be doing 😆 |
You dont? Well I'm moderating my online radio show right now thehe, but i kinda like how people get together here, i prefer smaller communites over those big ones where noone know the other and people just rant around~ |
@sergalbutt I'd love to hear how it worked after you tried. I hope it works like intended, even if it may be a dirty hack :D @muhkuh2005 As long as we actively discuss the issue, I don't see anything wrong with that. If we start to talk about our anime collection however, it'd be offtopic and most likely unwanted. I'm out of this one for now, tell me if it worked :) I also added a public email address if you'd like to contact me. |
@HungryFeline It didn't work 😢 |
@muhkuh2005 The better thing I could be doing right now is sleeping. It's nearly 1am here. But instead I come here with a n00bish problem for this wonderful piece of software. |
What was the problem? Did it show any error message? |
@HungryFeline Nope, but I don't have the PHP error display thing on. Stupid me. Also, I gave it a try with 2 tags, the first a count 1002 and the second a count of 51 |
And I don't actually remember how to get PHP errors to display in-browser... |
Wait I found it. Let me give it another go... My apologies for being a 'tard about this... |
@HungryFeline Boom. Fatal error: Maximum execution time of 300 seconds exceeded in S:\XAMPP\htdocs\shimmie\core\database.class.php on line 391 |
Thats what i was afraid off, the max execution time... |
I have no idea what I would set it to. It could take days with all the tags I have D: F*** it. I'm going to bed and I will continue this after I wake. Thanks for your help @muhkuh2005 & @HungryFeline |
Since max_execution_time can be changed anywhere, you could just add ini_set('max_execution_time',0); to your data/config/shimmie.conf.php |
@HungryFeline only works with safe_mode beeing deactivated |
http://www.php.net/manual/en/features.safe-mode.php
I'm not on a shared hoster so I've never used it anyways. Setting open_basedir and disabling certain functions is enough imho. sergalbutt shouldn't have problems, too. XAMPP has this disabled (and should also have a newer PHP version). |
I'm not sure what version of PHP I'm running, but safe_mode exists and it is deactivated because it's the only way I could get nice URLs to work. |
SO I test it in 4 different ways, and this handy little table shows how many tags were used and the total tag count.
tl;dr It works. The more tags you feed it, the slower it is (but duh, right? 👅) but it works. Thanks again for all your help~ 😄 |
Glad to hear it's working. Well, you're dealing with a lot of data, normally, this should be done with a CLI script and not over the browser. Like packing the images into a zip file. Even my Shimmie has 55,353 images (~50G)... |
When the tag categories extension got introduced, I found myself having to re-tag a buttload of images via the 'Mass tag edit' admin tool because existing images don't use the aliases I set (or at least they didn't when I tried)
Having very little knowledge of PHP, I just can't code something myself, nor can I work out how the hell to do it via MySQL.
Having something similar to the tag alias CSV upload thing but to re-tag images would be fantastic, but I can settle with someone just telling me how to do it on a mass scale via a PHP form or SQL query would be just as helpful.
The text was updated successfully, but these errors were encountered: