Tumblr sorter how to make

Tumblr sorter how to make

sorter code and instructions to it

i’ve gotten a lot of requests for sorters i simply can’t make and some people even asked if i could share the code for the sorters!! so here i am with a simple tutorial. please read the instructions carefully and feel free to ask me for help 🙂

quick access to html code here.

1. add a new page

go to theme customization of your blog, create a new page where you want the sorter, and then select custom layout. you also need to pick an url for the sorters page.

Tumblr sorter how to make. Смотреть фото Tumblr sorter how to make. Смотреть картинку Tumblr sorter how to make. Картинка про Tumblr sorter how to make. Фото Tumblr sorter how to make

2. paste the html

you can find the html here. paste it into the sorter, make sure you get everything.

3. name your sorter

use ctrl+f on within the html editor to search for SORTER NAME (or scroll a bit upwards from the bottom), replace it with whatever you wish to name your sorter. you can also edit the description right after the name. be careful not to mess up the html code though!

Tumblr sorter how to make. Смотреть фото Tumblr sorter how to make. Смотреть картинку Tumblr sorter how to make. Картинка про Tumblr sorter how to make. Фото Tumblr sorter how to make

use ctrl+f within the sorter again and search for option (or scroll all the way up, it’s almost at the top). you’ll find a list of options where you can simply add your own. you can have as many options as you wish. the only thing you need to remember is to add a comma after every option except the last one, otherwise the sorter won’t work.

Tumblr sorter how to make. Смотреть фото Tumblr sorter how to make. Смотреть картинку Tumblr sorter how to make. Картинка про Tumblr sorter how to make. Фото Tumblr sorter how to make

now all you need to do is save the page and your sorter is ready to go!

i hope you guys enjoy this! it’s my first time sharing a code on tumblr so i hope everything works as it should, and as i mentioned earlier, feel free to message me with questions!

— Song Sorters Masterlist

Для этого и создано приложение.

Tumblr sorter how to make. Смотреть фото Tumblr sorter how to make. Смотреть картинку Tumblr sorter how to make. Картинка про Tumblr sorter how to make. Фото Tumblr sorter how to make

Song Sorters Masterlist

*If you want to request anything go here https://curiouscat.qa/tooyoungljp 🙂

*also if a link isn’t working please lmk, you can also search it by using “alwaysyouli.tumblr.com/‘album title’songsorter” and it should come up 🙂

After Hours by The Weeknd

Better Mistakes by Bebe Rexha

BLACKPINK’s Solo Songs

Blurryface by Twenty One Pilots

The Click by AJR

dont smile at me by Billie Eilish

Happier Than Ever by Billie Eilish

The Highlights by The Weeknd

KILL THIS LOVE by BLACKPINK

Liam Payne’s Discography

Living Room by AJR

Neotheater by AJR

Niall Horan’s Discography

Nobody Is Listening by ZAYN

OK ORCHESTRA by AJR

One Direction’s Discography

One Direction’s Solo Albums

Planet Her by Doja Cat

Queendom by Red Velvet

Rare by Selena Gomez

Revival by Selena Gomez

Scaled and Icy by Twenty One Pilots

Sing To Me Instead by Ben Platt

SOUR by Olivia Rodrigo

SQUARE ONE by BLACKPINK

SQUARE TWO by BLACKPINK

SQUARE UP by BLACKPINK

Superbloom by Ashton Irwin

Stars Dance by Selena Gomez

Take Me Home by One Direction

Taylor Swift by Taylor Swift

Taylor Swift’s Discography

THE ALBUM by BLACKPINK

The Rabbit Hole by Ashe

Trench by Twenty One Pilots

Twenty One Pilots’s Discography

Twenty One Pilots by Twenty One Pilots

Up All Night by One Direction

Vessel by Twenty One Pilots

WHEN WE ALL FALL ASLEEP, WHERE DO WE GO? by Billie Eilish

Seedmanc/Tumblr-image-sorter

Use Git or checkout with SVN using the web URL.

Work fast with our official CLI. Learn more.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching Xcode

If nothing happens, download Xcode and try again.

Launching Visual Studio Code

Your codespace will open once ready.

There was a problem preparing your codespace, please try again.

Latest commit

Git stats

Files

Failed to load latest commit information.

README.md

A userscript & an addon for image file name and save path formatting based on tags.

Table of contents

This userscript saves you time spent on renaming images and choosing the right directory for saving them in accordance with post tags. You provide a list of tags matching with folder names for them, the script analyzes tags in the post containing the image and chooses the right directory for you, as well as putting required tags into image file name in danbooru fashion (replacing spaces with underscores). In addition it can translate tags using the same matching list, indicate which images have been already saved and fix some common design problems of tumblr themes.

Suppose you save images from tumblr often and want to have them organized nicely on disk. You have a large enough folder tree, navigating which manually for every image might be a time consuming and boring task. Meanwhile the information that you’re making your folder selection choices on is right there in the tags associated with posts, provided that the post author uses the tagging system responsibly. Even if you don’t have any particular folder structure and just save everything into one folder, having tags put into filenames can be useful for searching. This userscript can do all that and more.

The script collects tags associated with image posts as you navigate tumblr and puts that information into a database. When you open an image in a new tab it searches for its tags, looks at the folder structure you provided it with and makes decision which folder should the current image be saved to. Additionally, if multiple matching folders are found, the image can be put to a predefined «group» folder. If there are any unrecognized tags (the ones you don’t have assigned folders to) the image can be saved to another predefined folder for later manual sorting.

Folder decision logic

Let’s define some key terms. First, assume the majority of images you’re dealing with are photos of people and as such tags mostly have people names in it, while your folder structure has separate directories for every person whose photos you’re interested in. There can also be other tags aside from names. All the folders are located in a base folder which we’ll refer to as ‘root’. Now, to the terms:

The table below shows all the possible combinations of tags in every category and the folder that will be assigned to an image in every case. Destination is relative to the root folder and assumes you have separate directories for every special folder pointer as described above. Before » is the folder name, after is the filename composed by the script, followed by any meta tags if present. The original image filename is appended to the end of all that, ensuring uniqueness.

Currently the project consists of two userscripts, called «animage-post» and «animage-get». Note that despite having «animage» in the name they are configured to work with the majority of tumblr blogs, or, rather, popular themes, and also on the dashboard. «Animage» is there just for legacy and tribute reasons, because I started development of this project when I was only using http://animage.tumblr.com.

There’s also an addon version with same functionality for Firefox that incorporates both scripts and provides a GUI, get it here.

Data required for the script

In order to make proper decisions, the script needs to consult several databases of tags, namely, the folder, name and meta databases.

There is also an additional smaller database of ignored tags, that is used to filter the tag list before further processing. You can use it to avoid having unneeded tags in the filename and decrease amount of unrecognized tags. It can be changed by editing the GET script.

Currently there is support for many popular themes that don’t have infinite scroll. For themes with it enabled the script will only process the first X posts before the scroll kicks in; however, even for unprocessed posts it would be able to retrieve data for single-image posts that link to the /image/ page of tumblr (and those usually are the majority). Having tile layout might decrease expected compatibility further.

Below is the theme compatibility table. The percentage value shows how much I am sure that there will possibly be no problems with using the script in a blog with such theme. For example, if the script seems to be working fine after testing, but to make it work properly it took me a lot of tinkering I can’t be sure that I didn’t miss anything compared to themes where the script worked normally right away.

Basically, every theme that has post containers with ‘class=»post»‘ and contains both post images and link to post within said node should be working fine.

Theme nameTheme URLCompatibility %
?http://marumichannel.tumblr.com90
alvahttp://www.tumblr.com/theme/3670495
Catching Elephanthttp://www.tumblr.com/theme/728590
Effectorhttp://www.tumblr.com/theme/1740390
ER2http://cubicle17.com100
Masonitehttp://hellodirty.com85
Minimal by Artur Kimhttp://arturkim.com100
o by inkyhttp://www.tumblr.com/theme/138690
Opticahttp://www.tumblr.com/theme/37310100
PixelUnion Fluidhttp://www.tumblr.com/theme/97965
plain by selkashttp://selkas.tumblr.com80
reduxhttp://thm—reducereuseandredux.tumblr.com90
seigakuhttp://sakurane.tumblr.com/preview/seigaku90
Simple Thingshttp://singleatheme.tumblr.com100
Single Ahttp://www.tumblr.com/theme/28638100
Tincturehttp://tincturetheme.tumblr.com75
tuesday by selkashttp://selkas.tumblr.com85
Viwan themehttp://viwan-th.tumblr.com95

PixelUnion Fluid is very weird and I coudln’t find enough blogs using it to test all features. The Minimalist theme might miss the saved images indication feature.

Themes with inbuilt WikPlayer are not supported. It seems that said player wraps the entire page into an iframe hosted elsewhere which breaks things.
Blogs with password-only access or custom domains aren’t supported either due to API limitations.

Aside from main functionality the script also makes slight changes to tumblr design. The most noticeable one is the outline around images that were already saved with the script (not just «save as. «). This way you can keep track of pictures you have. Note that that this feature is cross-blog, meaning that if you saved a picture from one blog and then encountered it in a reblogged post in another tumblr it will still be marked as saved there.

Another important ability is linking inline images in all posts (not just photo ones) to either their HD version if available or to the Google reverse image search of the particular image. If the HD version of an image is available (which should be the majority of cases from now on) it will be processed just like any other image in a photo post. This allows for collecting image and data from any kind of post, increasing coverage.

Other features include changing destination of links on single image posts directly to the picture skipping the /image/ subpage of tumblr; linkifying even small images that usually don’t have links over them (because GET script requires every image to be opened in a separate tab); and also fixing the particular problem in some themes where links to hi-res versions of the images in posts are covered by a transparent

Once you’ve installed the scripts (for instructions see README in the version folder of your choice) you’ll need to fill in at least the Folders database which is located in the GET script. You can use the dir /s/b/o:n/A:D > folders.txt command from the root directory to get the list of all folders and subfolders in text format, then use software like Excel to format the list further. Make sure to avoid using symbols illegal for file paths in your OS and don’t forget to use double ‘\’ instead of single everywhere. Note that if you intend to use both unicode and ansi tags, you can avoid having to enter both variations of a single tag pointing to one folder. Just enter the unicode tag : roman folder name pair and enable «useFolderNames» option in settings.

By default the DB has the configuration that I’m using myself, around 80 japanese name tags in kanji translating to folder names in English. Additionally you might want to fill in the auxiliary name and meta databases if your use case happens to be the same as mine. Use the import feature for that. From a tab with opened image click +settings+ menu in GUI. Then choose import db there, and select the names&meta tags DB.txt file that I provided in the repository. You can edit it to your liking beforehand (use something better than just Notepad, I recommend Notepad++), just make sure not to violate it’s structure. The auxiliary DB has around 150+ more names and 20 meta tags with translations.

Note that if there are duplicating tag entries among these 3 DBs, the following hierarchy takes place: Folders > names > meta.

Another thing to note, there are limits on the amount of data stored in flash cookies. I believe the default value is 100kb. While every record for an image takes relatively little space (about 80 bytes per image), the data is continuously added as you navigate tumblr and encounter new posts. Eventually you’ll hit the limit and will be notified about that by the POST script. You might want to set the limit to at least 1 megabyte since very beginning. Head over to http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager07.html look for your storeUrl host in the list ( dl.dropboxusercontent.com by default) and change the value as you see fit.

In the userscript version most settings are changed via editing the values inside the scripts, no centralized GUI so far. Addon has a specialized GUI.

The settings area can be found in the beginning of each script, right after the userscript header. Default values should be fine for usage right away.

Some settings are common for both scripts:

The debug mode has the following effects on the scripts’ behaviour:

— enables error notifications via alert message, including errors from other scripts of the page. Without debug mode errors are directed back to console, user will only see an ✗ mark in the title upon encountering an error.
— brings the FlashDB window into view (top-left corner). This way if a size limit has been hit the user will see a flash notification about that and have the ability to change settings from there.

You can rehost the flash objects somewhere else if you want, but keep in mind that every time you change the storeUrl variable the databases (except the inbuilt ones like Folders & ignore) are created from scratch. Previous versions are not deleted, so you can return to them by changing the url back.

Other settings are script-specific:

Yet other settings are version-specific, see the readme inside the version folder of your choice for them.

Assuming there are tags and all of them were recognized, just click the Save to disk button. Save dialog will appear, paste the path into the filename text field (I usually do that with Shift-Insert ), click Save (or hit Enter ) and you’re done. Much better than having to navigate between many folders before saving, isn’t it? Even better, if you find yourself often reuploading saved images somewhere else, you can paste same path into open dialog and have last saved image selected automatically without having to look for it. If you’re saving several images in a row into a single folder, there’s no need to paste the path every time, the previous save path will be used.

Managing unrecognized tags

The script provides a convenient GUI for dealing with tags missing from any DBs. On image page they will be listed at the left side under Save to disk button. From there you’ll have a choice to select a category (name or meta) for every tag, additionally entering translation for tags in Unicode (usually kanji), or to simply ignore those tags and remove them from analysis for now (see the picture). To ignore a tag click on it and it will be hidden until page reload. After you made your choices, click the Submit button to apply them and look at the difference it made to the page title.

A few things to consider:

The code is thoroughly commented, I tried to explain everything I’m doing there. However I’m a newbie programmer so formatting might be weird and the code is rather messy.

This userscript uses the following libraries:

By default the script is configured to use pre-hosted libraries and media linked to my Dropbox, so you don’t have to worry about hosting them yourself, unless specified otherwise in the installation notes of a particular script version. Should you want to do that regardless, take a look at the dependencies and media folders, they have the necessary files or links to repositories containing them.

Current status & versions

(aka «How you can help»)

I still have yet to find a way for a userscript to load information from a file on HDD automatically.

Should help with lazy rebloggers never properly tagging anything.

Will probably have to hook on the post retrieval events or something. Oh the glitches. You can use no-scroll addons so far.

This will help when a large photoset has no tags, rendering the script (and the post) useless. Dunno how to make that propagation live across tabs though, something about messages maybe.

Will have to think of a way to store folder lists more efficiently than in an object.

This will also make support of OS other than Windows possible. Already done in addon version.

Blah-blah MIT blah, you know the stuff. Just don’t claim authorship and it’ll be fine.

About

Image file name and save path formatting based on tags.

Tumblr sorter how to make

Юзерскрипт и аддон для автоматического выбора пути сохранения изображений на основе тегов.

Юзерскрипт предназначен для экономии времени, обычно тратящегося на выбор папки сохранения и имени файла для картинок. Вы предоставляете список сопоставления тегов и папок, скрипт анализирует теги для каждого изображения, выбирает подходящую для него папку и добавляет нужные теги в имя файла в стиле danbooru (заменяя пробелы на знак подчёркивания). Кроме того, есть возможность перевода тегов с другого языка с использованием того же списка сопоставления, выделения уже сохранённых изображений и исправления некоторых типичных проблем в темах оформления.

Представьте, что вы часто сохраняете фото с тумблера и стремитесь содержать коллекцию в порядке. Имея разветвлённое дерево каталогов в коллекции можно потратить много времени выбирая нужную папку для сохранения каждой картинки. В то же время, информация, на основе которой делается этот выбор находится в тегах поста, содержащего изображения (если автор поста ответственно подошёл к их проставлению). Даже если вы просто сохраняете все картинки в одну папку, было бы удобно добавлять теги, описывающие содержимое изображения в имя файла. Все это и многое другое становится возможным благодаря данному юзерскрипту.

Скрипт сохраняет теги постов в БД в процессе навигации по тумблеру. Когда вы открываете картинку в новой вкладке, скрипт находит связанные с ней теги, сверяет их со списком сопоставления папок и тегов и принимает решение о том, куда следует сохранить текущее изображение. Если подходит несколько папок, можно сохранить картинку в специальную директорию для групповых фото. Если какие-либо теги не удаётся распознать (для них не назначено папок или перевода), для изображений с ними можно выбрать отдельную папку для последующей ручной сортировки.

Логика выбора папок

Для начала определим некоторые понятия. Во-первых, ради примера предположим, что большинство изображений, сохраняемых вами с тумблера это фотографии людей, так что теги в основном содержат их имена. Папки в вашей коллекции также названы их именами и все находятся в главной директории, которую мы будем называть «root». Основные понятия:

Как видно, в случае наличия ровно одного тега, указывающего на папку-подкатегорию, изображения, которые в другом случае были бы сохранены в общие соло или групповую папки сохраняются в папку категории. Однако в случае наличия нескольких категорийных тегов они расцениваются как обычные мета-теги, потому что выбрать какой-либо конкретный невозможно.
При наличии нераспознанных тегов, требующих перевода (например, теги в юникоде), они обрамляются в квадратные скобки для удобства поиска.

На данный момент проект состоит из двух юзерскриптов, «animage-post» и «animage-get».

Кроме того, есть версия в виде аддона для Firefox, содержащая функционал обоих скриптов и пользовательский интерфейс. Найти ее можно здесь.

Чтобы правильно выбрать папку для сохранения, скрипту требуется обращаться к нескольким базам данных тегов: folder, name и meta.

Кроме того, есть ещё список игнорируемых тегов, используемый для удаления ненужных тегов перед обработкой. Список содержится в теле второго скрипта, после списка папок.

На данный момент скрипт поддерживает большинство популярных тем оформления с выключенной функцией бесконечной прокрутки. Если же эта функция включена, скрипт обработает только те несколько постов, которые были загружены на страницу до момента активации прокрутки. Тем не менее, даже для последующих необработанных постов скрипт сможет корректно собрать информацию о тегах, если это посты, содержащие одну картинку, указывающую на страницу просмотра изображения (/image/); как правило, такие типы постов в числе большинства. Наличие плиточного дизайна в теме, возможно, снизит совместимость.

Ниже представлена таблица совместимости с темами оформления. Процент совместимости показывает насколько я могу быть уверен, что скрипт будет корректно работать с конкретной темой оформления. К примеру, даже если на данный момент скрипт будто бы работает корректно с определённой темой, но добиться этого стоило некоторых усилий, то такая тема получит более низкую оценку совместимости, по сравнению с темой, где скрипт работал правильно с самого начала.

Имя темыАдресСовместимость, %
?http://marumichannel.tumblr.com90
alvahttp://www.tumblr.com/theme/3670495
Catching Elephanthttp://www.tumblr.com/theme/728590
Effectorhttp://www.tumblr.com/theme/1740390
ER2http://cubicle17.com100
Masonitehttp://hellodirty.com85
Minimal by Artur Kimhttp://arturkim.com100
o by inkyhttp://www.tumblr.com/theme/138690
Opticahttp://www.tumblr.com/theme/37310100
PixelUnion Fluidhttp://www.tumblr.com/theme/97965
plain by selkashttp://selkas.tumblr.com80
reduxhttp://thm—reducereuseandredux.tumblr.com90
seigakuhttp://sakurane.tumblr.com/preview/seigaku90
Simple Thingshttp://singleatheme.tumblr.com100
Single Ahttp://www.tumblr.com/theme/28638100
Tincturehttp://tincturetheme.tumblr.com75
tuesday by selkashttp://selkas.tumblr.com85
Viwan themehttp://viwan-th.tumblr.com95

PixelUnion Fluid довольно нестандартна в своём оформлении, мне не удалось собрать достаточно статистики чтобы оценить её совместимость. В The Minimalist может отсутствовать выделение сохранённых изображений на страницах.

Темы со встроенным WikPlayer’ом не поддерживаются. Похоже, что этот плеер оборачивает всю страницу в iframe, находящийся за пределами Тумблера.
Также не поддерживаются блоги, защищенные паролем и блоги на собственных доменах, ввиду ограниченной доступности информации из них через API.

Другая полезная возможность заключается в добавлении ссылок для каждого вложенного изображения в посте (не только картинок в фото-постах) либо напрямую на HD-версию картинки (если есть), либо на поиск этого изображения в гугле. Таким образом становится возможным сбор изображений и информации из любых постов, не ограничиваясь только категорией фото.

В числе прочих возможностей: изменение ссылок одиночных изображений в фотопостах напрямую на полную версию картинки в обход страницы /image/; добавление ссылок даже для фото низкого разрешения (потому что скрипту требуется открытие изображений в отдельной вкладке); исправление ошибки в некоторых темах, где прозрачный

После установки скрипта (инструкции представлены в README, расположенном в папке конкретной версии) потребуется как минимум заполнить список соответствия тегов и папок в GET-скрипте. Для быстрого составления описания дерева папок в текстовом формате можно выполнить dir /s/b/o:n/A:D > folders.txt в командной строке корневой директории коллекции, после чего использовать редактор типа Excel для дальнейшего форматирования списка по примеру. Используйте двойные ‘\’ вместо одиночных. Если планируется работа с тегами в юникоде наряду с обычными для одного и того же имени, можно использовать опцию «useFolderNames», чтобы избежать ввода обеих версий тега. Достаточно будет ввести пару «тег в юникоде : имя папки в ansi», распознаны будут теги в обоих вариантах записи.

При наличии повторяющихся записей среди БД папок и дополнительных БД имеет место быть следующая иерархия: Folders > names > meta.

Следует заметить, что на размер флэш-БД имеются ограничения, по умолчанию это 10-100 кбайт. Несмотря на то, что каждая запись в БД для отдельного изображения занимает сравнительно мало места (около 70 байт), БД постоянно продолжают заполняться в процессе навигации по тумблеру. Рано или поздно указанный лимит будет достигнут и POST-скрипт покажет уведомление о необходимости его повысить. Можно сделать это с самого начала, в настройках флэша на http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager07.html найдите домен из переменной storeUrl (по умолчанию это dl.dropboxusercontent.com ) и выставите значение хотя бы в 1 мегабайт.

В юзерскрипт-версии большинство настроек производится редактированием значений переменных в теле скриптов. У аддона для этого есть окно настроек.

Область настроек находится в начале каждого файла, сразу после заголовка юзерскрипта.

Часть настроек является общей для обоих скриптов:

Режим отладки предусматривает следующие изменения в поведении скриптов:

— включает уведомления обо всех ошибках посредством всплывающих окон сообщений. Без уведомлений пользователь увидит только ✗ в заголовке вкладки в случае ошибки, а сами сообщения будут перенаправлены в консоль.
— показывает окно флэш-БД в левом верхнем углу окна, что позволяет увидеть сообщение о превышении ограничения БД по размеру и разрешить повысить лимит.

Обратите внимание, что при изменении storeUrl все флэш-БД пересоздаются с нуля. Предыдущие версии не удаляются, так что к ним можно вернуться, восстановив прежнее значение этой переменной.

Остальные настройки разные для каждого скрипта:

Есть также некоторые настройки, особые для конкретной версии скрипта, они перечислены в документации к ней.

Работа с неизвестными тегами

Что нужно иметь в виду:

Информация о проекте

Код подробно прокомментирован, я попытался объяснять все, что я делаю. Однако, будучи новичком, я мог допустить некоторые ошибки с оформлением.

Юзерскрипт использует следующие библиотеки:

По умолчанию скрипт использует файлы и библиотеки, находящиеся в моем дропбоксе, если не требуется их ручная установка в конкретной версии. Если же вам понадобится использовать собственный хостинг, нужные файлы или ссылки на них можно найти в папках dependencies и media.

(или «Как я могу помочь проекту»)

Понятия не имею, как автоматически подгружать данные из файла на диске в юзерскрипте.

Поможет с реблогами ленивых юзеров.

Наверное, как-то придётся ловить событие прокрутки или что-то такое, вот багов-то будет. Пока можно использовать no-scroll аддоны.

Будет полезно для длинных фотосетов без тегов или же с большим количеством нерелевантных тегов. Надо полагать, придётся возиться с постингом сообщений между окнами.

Нужно будет придумать более эффективный способ хранения списка тегов, нежели в объекте с полями. Множества бы подошли.

Это также обеспечит поддержку ОС кроме Windows. Уже реализовано в формате аддона.

Tumblr sorter how to make. Смотреть фото Tumblr sorter how to make. Смотреть картинку Tumblr sorter how to make. Картинка про Tumblr sorter how to make. Фото Tumblr sorter how to make Seedmanc/Tumblr-image-sorter

Image file name and save path formatting based on tags.

A userscript & an addon for image file name and save path formatting based on tags.

Table of contents

This userscript saves you time spent on renaming images and choosing the right directory for saving them in accordance with post tags. You provide a list of tags matching with folder names for them, the script analyzes tags in the post containing the image and chooses the right directory for you, as well as putting required tags into image file name in danbooru fashion (replacing spaces with underscores). In addition it can translate tags using the same matching list, indicate which images have been already saved and fix some common design problems of tumblr themes.

Suppose you save images from tumblr often and want to have them organized nicely on disk. You have a large enough folder tree, navigating which manually for every image might be a time consuming and boring task. Meanwhile the information that you’re making your folder selection choices on is right there in the tags associated with posts, provided that the post author uses the tagging system responsibly. Even if you don’t have any particular folder structure and just save everything into one folder, having tags put into filenames can be useful for searching. This userscript can do all that and more.

The script collects tags associated with image posts as you navigate tumblr and puts that information into a database. When you open an image in a new tab it searches for its tags, looks at the folder structure you provided it with and makes decision which folder should the current image be saved to. Additionally, if multiple matching folders are found, the image can be put to a predefined «group» folder. If there are any unrecognized tags (the ones you don’t have assigned folders to) the image can be saved to another predefined folder for later manual sorting.

Folder decision logic

Let’s define some key terms. First, assume the majority of images you’re dealing with are photos of people and as such tags mostly have people names in it, while your folder structure has separate directories for every person whose photos you’re interested in. There can also be other tags aside from names. All the folders are located in a base folder which we’ll refer to as ‘root’. Now, to the terms:

The table below shows all the possible combinations of tags in every category and the folder that will be assigned to an image in every case. Destination is relative to the root folder and assumes you have separate directories for every special folder pointer as described above. Before ‘\’ is the folder name, after is the filename composed by the script, followed by any meta tags if present. The original image filename is appended to the end of all that, ensuring uniqueness.

Currently the project consists of two userscripts, called «animage-post» and «animage-get». Note that despite having «animage» in the name they are configured to work with the majority of tumblr blogs, or, rather, popular themes, and also on the dashboard. «Animage» is there just for legacy and tribute reasons, because I started development of this project when I was only using http://animage.tumblr.com.

There’s also an addon version with same functionality for Firefox that incorporates both scripts and provides a GUI, get it here.

Data required for the script

In order to make proper decisions, the script needs to consult several databases of tags, namely, the folder, name and meta databases.

There is also an additional smaller database of ignored tags, that is used to filter the tag list before further processing. You can use it to avoid having unneeded tags in the filename and decrease amount of unrecognized tags. It can be changed by editing the GET script.

Currently there is support for many popular themes that don’t have infinite scroll. For themes with it enabled the script will only process the first X posts before the scroll kicks in; however, even for unprocessed posts it would be able to retrieve data for single-image posts that link to the /image/ page of tumblr (and those usually are the majority). Having tile layout might decrease expected compatibility further.

Below is the theme compatibility table. The percentage value shows how much I am sure that there will possibly be no problems with using the script in a blog with such theme. For example, if the script seems to be working fine after testing, but to make it work properly it took me a lot of tinkering I can’t be sure that I didn’t miss anything compared to themes where the script worked normally right away.

Basically, every theme that has post containers with ‘class=»post»‘ and contains both post images and link to post within said node should be working fine.

Theme nameTheme URLCompatibility %
?http://marumichannel.tumblr.com90
alvahttp://www.tumblr.com/theme/3670495
Catching Elephanthttp://www.tumblr.com/theme/728590
Effectorhttp://www.tumblr.com/theme/1740390
ER2http://cubicle17.com100
Masonitehttp://hellodirty.com85
Minimal by Artur Kimhttp://arturkim.com100
o by inkyhttp://www.tumblr.com/theme/138690
Opticahttp://www.tumblr.com/theme/37310100
PixelUnion Fluidhttp://www.tumblr.com/theme/97965
plain by selkashttp://selkas.tumblr.com80
reduxhttp://thm—reducereuseandredux.tumblr.com90
seigakuhttp://sakurane.tumblr.com/preview/seigaku90
Simple Thingshttp://singleatheme.tumblr.com100
Single Ahttp://www.tumblr.com/theme/28638100
Tincturehttp://tincturetheme.tumblr.com75
tuesday by selkashttp://selkas.tumblr.com85
Viwan themehttp://viwan-th.tumblr.com95

PixelUnion Fluid is very weird and I coudln’t find enough blogs using it to test all features. The Minimalist theme might miss the saved images indication feature.

Themes with inbuilt WikPlayer are not supported. It seems that said player wraps the entire page into an iframe hosted elsewhere which breaks things.
Blogs with password-only access or custom domains aren’t supported either due to API limitations.

Aside from main functionality the script also makes slight changes to tumblr design. The most noticeable one is the outline around images that were already saved with the script (not just «save as. «). This way you can keep track of pictures you have. Note that that this feature is cross-blog, meaning that if you saved a picture from one blog and then encountered it in a reblogged post in another tumblr it will still be marked as saved there.

Another important ability is linking inline images in all posts (not just photo ones) to either their HD version if available or to the Google reverse image search of the particular image. If the HD version of an image is available (which should be the majority of cases from now on) it will be processed just like any other image in a photo post. This allows for collecting image and data from any kind of post, increasing coverage.

Other features include changing destination of links on single image posts directly to the picture skipping the /image/ subpage of tumblr; linkifying even small images that usually don’t have links over them (because GET script requires every image to be opened in a separate tab); and also fixing the particular problem in some themes where links to hi-res versions of the images in posts are covered by a transparent

Once you’ve installed the scripts (for instructions see README in the version folder of your choice) you’ll need to fill in at least the Folders database which is located in the GET script. You can use the dir /s/b/o:n/A:D > folders.txt command from the root directory to get the list of all folders and subfolders in text format, then use software like Excel to format the list further. Make sure to avoid using symbols illegal for file paths in your OS and don’t forget to use double ‘\’ instead of single everywhere. Note that if you intend to use both unicode and ansi tags, you can avoid having to enter both variations of a single tag pointing to one folder. Just enter the unicode tag : roman folder name pair and enable «useFolderNames» option in settings.

By default the DB has the configuration that I’m using myself, around 80 japanese name tags in kanji translating to folder names in English. Additionally you might want to fill in the auxiliary name and meta databases if your use case happens to be the same as mine. Use the import feature for that. From a tab with opened image click +settings+ menu in GUI. Then choose import db there, and select the names&meta tags DB.txt file that I provided in the repository. You can edit it to your liking beforehand (use something better than just Notepad, I recommend Notepad++), just make sure not to violate it’s structure. The auxiliary DB has around 150+ more names and 20 meta tags with translations.

Note that if there are duplicating tag entries among these 3 DBs, the following hierarchy takes place: Folders > names > meta.

Another thing to note, there are limits on the amount of data stored in flash cookies. I believe the default value is 100kb. While every record for an image takes relatively little space (about 80 bytes per image), the data is continuously added as you navigate tumblr and encounter new posts. Eventually you’ll hit the limit and will be notified about that by the POST script. You might want to set the limit to at least 1 megabyte since very beginning. Head over to http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager07.html look for your storeUrl host in the list ( dl.dropboxusercontent.com by default) and change the value as you see fit.

In the userscript version most settings are changed via editing the values inside the scripts, no centralized GUI so far. Addon has a specialized GUI.

The settings area can be found in the beginning of each script, right after the userscript header. Default values should be fine for usage right away.

Some settings are common for both scripts:

The debug mode has the following effects on the scripts’ behaviour:

— enables error notifications via alert message, including errors from other scripts of the page. Without debug mode errors are directed back to console, user will only see an ✗ mark in the title upon encountering an error.
— brings the FlashDB window into view (top-left corner). This way if a size limit has been hit the user will see a flash notification about that and have the ability to change settings from there.

You can rehost the flash objects somewhere else if you want, but keep in mind that every time you change the storeUrl variable the databases (except the inbuilt ones like Folders & ignore) are created from scratch. Previous versions are not deleted, so you can return to them by changing the url back.

Other settings are script-specific:

Yet other settings are version-specific, see the readme inside the version folder of your choice for them.

Assuming there are tags and all of them were recognized, just click the Save to disk button. Save dialog will appear, paste the path into the filename text field (I usually do that with Shift-Insert ), click Save (or hit Enter ) and you’re done. Much better than having to navigate between many folders before saving, isn’t it? Even better, if you find yourself often reuploading saved images somewhere else, you can paste same path into open dialog and have last saved image selected automatically without having to look for it. If you’re saving several images in a row into a single folder, there’s no need to paste the path every time, the previous save path will be used.

Managing unrecognized tags

The script provides a convenient GUI for dealing with tags missing from any DBs. On image page they will be listed at the left side under Save to disk button. From there you’ll have a choice to select a category (name or meta) for every tag, additionally entering translation for tags in Unicode (usually kanji), or to simply ignore those tags and remove them from analysis for now (see the picture). To ignore a tag click on it and it will be hidden until page reload. After you made your choices, click the Submit button to apply them and look at the difference it made to the page title.

A few things to consider:

The code is thoroughly commented, I tried to explain everything I’m doing there. However I’m a newbie programmer so formatting might be weird and the code is rather messy.

This userscript uses the following libraries:

By default the script is configured to use pre-hosted libraries and media linked to my Dropbox, so you don’t have to worry about hosting them yourself, unless specified otherwise in the installation notes of a particular script version. Should you want to do that regardless, take a look at the dependencies and media folders, they have the necessary files or links to repositories containing them.

Current status & versions

(aka «How you can help»)

I still have yet to find a way for a userscript to load information from a file on HDD automatically.

Should help with lazy rebloggers never properly tagging anything.

Will probably have to hook on the post retrieval events or something. Oh the glitches. You can use no-scroll addons so far.

This will help when a large photoset has no tags, rendering the script (and the post) useless. Dunno how to make that propagation live across tabs though, something about messages maybe.

Will have to think of a way to store folder lists more efficiently than in an object.

This will also make support of OS other than Windows possible. Already done in addon version.

Blah-blah MIT blah, you know the stuff. Just don’t claim authorship and it’ll be fine.

Project Statistics

Sourcerank2
Repository Size1.96 MB
Stars2
Forks0
Watchers2
Open issues0
Dependencies0
Contributors1
Tags5
Created Apr 27, 2015
Last updated Jan 23, 2017
Last pushed Nov 13, 2015

Top Contributors See all

Recent Tags See all

1.3September 11, 2015
v1.2.0September 05, 2015
v1.1.1July 16, 2015
v1.1.0-betaJune 05, 2015
v1.0.0-rcMay 04, 2015

Something wrong with this page? Make a suggestion

Last synced: 2016-05-27 17:30:26 UTC

Login to resync this repository

Libraries.io helps you find new open source packages, modules and frameworks and keep track of ones you depend upon.

Copyright © 2022 Tidelift, Inc
Code is Open Source under AGPLv3 license
Data is available under CC-BY-SA 4.0 license

Источники информации:

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *