AIMP Forum

AIMP for Windows => Плагины / Plugins => Дополнения / Addons => Плагины-дополнения / Addons => Topic started by: Covidalus on November 06, 2020, 14:14:41

Title: AIMP RYM Set Listening To
Post by: Covidalus on November 06, 2020, 14:14:41
Привет. Извините, я не говорю по-русски. Я перевел с помощью Дипла.

Плагин AIMP для новой функции "Прослушивание" на rateyourmusic.com. Github : https://github.com/Ylevo/AIMP_RYMSetListeningTo

Для работы плагина необходимо ввести RYM-токен аутентификации в файл config.xml, входящий в состав релиза. Его можно найти в cookie-файлах rateyourmusic.com с помощью инспектора хранилища вашего браузера. Файл cookie называется "ulv".

Сервер RYM кажется очень чувствительным к последовательным HTTP-запросам и может быстро заблокировать ваш, если вы слишком быстро на них пойдете. Учитывая это, я добавил как минимум 5 секунд прослушивания текущего трека перед тем, как сделать какой-либо запрос. По умолчанию в конфигурационном файле установлено значение 15 секунд.

Поисковая система RYM далека от совершенства и иногда не возвращает правильный альбом в качестве первого результата, что приводит к некорректному прослушиванию Set Listening To. Я ничего не могу с этим поделать. RYM позволяет точно определить, какую дорожку вы в данный момент слушаете, но со всеми разными стандартами прослушивания дорожек (см. https://rateyourmusic.com/wiki/Music:Standards%20for%20track%20listings), в то время как аудиофайлы обычно используют простые номера дорожек в метаданных, они часто не совпадают. Технически возможно запросить страницу альбома и найти идентификатор трека, но это будет еще один запрос к достаточно чувствительному серверу.

И, наконец, да, код грязный.

Я открыт для предложений.


English:
AIMP plugin for the new feature "Listening To" on rateyourmusic.com.

You have to enter your RYM authentification token in the config.xml file included in the release for the plugin to work. You can find it in your rateyourmusic.com cookies using the storage inspector of your browser. The cookie's name is "ulv".

RYM's server seems very sensitive to successive HTTP requests and can quickly block yours if you go too fast on them. Considering that, I've added a minimum of 5 seconds of listening to the current track before making any request. It's set to 15 secondes by default in the config file.

RYM search engine is far from perfect and will sometimes not return the correct album as first result, resulting in a bit wrong Set Listening To. I can't do anything about that. RYM makes it possible to precise what track you're currently listening to, but with all the different standards for track listing (see https://rateyourmusic.com/wiki/Music:Standards%20for%20track%20listings) while audio files usually use mere track numbers in metadata, it often fails to match. It is technically possible to request the album page and look for the track ID, but that would be yet another request to a quite sensitive server.

And finally, yes the code is dirty.

I'm open to suggestions and feedback.
Title: Re: AIMP RYM Set Listening To
Post by: JD on November 06, 2020, 14:35:20
I think we should wait for the official API (https://ru.rateyourmusic.com/rymzilla/view?id=683),
RYM servers will very quickly block your requests in such implementation
Title: Re: AIMP RYM Set Listening To
Post by: Covidalus on November 06, 2020, 15:21:01
Вот почему я уже связался с ними по поводу плагина. Запрос на веб-интерфейс датирован 2009 годом, и его до сих пор нет с последним обновлением сайта, так что, честно говоря, я на него не рассчитываю.
Думаю, я добавил достаточно задержки между запросами (максимум два из них на одно изменение), чтобы предотвратить блокировку. Не знаю, сработает ли это со многими людьми, использующими его.
Тем не менее, странно выпускать такую возможность без API для нее.

English:
That's why I've already contacted them about the plugin. The request for a web API is dated 2009 and it's still not there with the latest website revamp, so honestly, I am not counting on it.
I think I've added enough delay between the requests (maximum two of them per change) to prevent the blocking. No idea if it would work with many people using it.
Still, it's weird to release a feature like that without the API for it.
Title: Re: AIMP RYM Set Listening To
Post by: JD on November 08, 2020, 19:33:11
Despite my skepticism, I must admit that the plugin works and works quite well. I've noticed a couple of problems over course of my use.
Firstly, correct recording isn't always determined, some artists may have albums or singles with the same names. Another problem is when album has several editions. Despite the fact that I have in my collection and have already put a rating on a certain album, which is not the primary one, listening is counted for the first one. It turns out that I have one version on the shelf and listen to another.
Secondly, once the plugin counted listening to a random album, which I've never listened to and don't even know who it is.
Title: Re: AIMP RYM Set Listening To
Post by: Covidalus on November 09, 2020, 14:30:13
Это потому, что я проверяю название альбома, чтобы узнать, является ли это новым прослушиванием или нет. Название альбома является единственным идентификатором на данный момент, если его нет, то он не ищет идентификатор альбома в RYM и просто помещает название трека как "Listening To" (Прослушивание). Если вы поменяете трек, и название альбома останется прежним, он не будет зарегистрирован как новое прослушивание.
Что касается случайного альбома, который вы никогда не слушали (lol), то это поисковая система RYM облажалась и не дала правильного результата в качестве первого результата. Может быть, она вообще его не нашла. Например, если вы ищете "( )" от Sigur Ros, он не найдет его, если вы не добавите "Sigur Ros" рядом с ним. Я использую и название альбома, и имя исполнителя в плагине для поисковой части, но иногда этого все равно недостаточно для RYM.

Переведено с помощью www.DeepL.com/Translator (бесплатная версия)

English:
That is because I check the album title to know whether or not it is a new listening. Album name is the sole identifier at the moment, if there is none then it doesn't look for the album ID on RYM and simply put the track title as Listening To. If you change track and it's still the same album name, it won't register as a new listening.
Concerning the random album that you never listened to (lol), it's RYM's search engine that screwed up and didn't give the right result as first result. Maybe it didn't find it at all. For example if you look for "( )" by Sigur Ros, it won't find it if you don't add "Sigur Ros" next to it. I use both the album name and the artist name in the plugin for the search part, but sometimes it's still not enough for RYM.
Title: Re: AIMP RYM Set Listening To
Post by: JD on November 10, 2020, 14:33:37
Cause crash of ATE at exit.
Title: Re: AIMP RYM Set Listening To
Post by: Covidalus on November 10, 2020, 20:46:05
Crash of ATE? What is ATE?
Title: Re: AIMP RYM Set Listening To
Post by: JD on November 10, 2020, 21:20:13
Advanced Tag Editor. AIMPate.exe
You plugin is loaded in all AIMP components (ATE and AudioConverter too).
You should check availability of AIMPPlayer service and only load the plugin if available.