spotify-profile-monitor 2.8__tar.gz → 2.9__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: spotify_profile_monitor
3
- Version: 2.8
3
+ Version: 2.9
4
4
  Summary: Tool implementing real-time tracking of Spotify users activities and profile changes including playlists
5
5
  Author-email: Michal Szymanski <misiektoja-pypi@rm-rf.ninja>
6
6
  License-Expression: GPL-3.0-or-later
@@ -38,24 +38,25 @@ OSINT tool for real-time monitoring of **Spotify users' activities and profile c
38
38
  <a id="features"></a>
39
39
  ## Features
40
40
 
41
- - Real-time tracking of Spotify user activities and profile changes:
42
- - addition/removal of followings and followers
43
- - addition/removal of playlists
44
- - addition/removal of tracks in playlists (including collaborator info for newly added tracks)
45
- - playlists name and description changes
46
- - number of likes for playlists
47
- - number of collaborators for playlists
48
- - profile picture changes
49
- - username changes
50
- - Email notifications for various events (as listed above)
51
- - Attaching changed profile pictures directly to email notifications
52
- - Displaying the profile picture right in your terminal (if you have `imgcat` installed)
53
- - Additional functionalities on top of the monitoring mode allowing to display detailed info about the user, list of followers & followings, recently played artists and possibility to search for users in Spotify catalog with specific names
54
- - Ability to display and export the list of tracks for a specific playlist (including Liked Songs for the user who owns the Spotify access token)
55
- - Saving all profile changes (including playlists) with timestamps to the CSV file
56
- - Clickable Spotify, Apple Music, YouTube Music and Genius Lyrics search URLs printed in the console & included in email notifications
57
- - Support for four different methods to get a Spotify access token (`sp_dc cookie`, `desktop client`, `OAuth app`, `OAuth user`)
58
- - Possibility to control the running copy of the script via signals
41
+ - **Real-time tracking** of Spotify user activities and profile changes:
42
+ - addition/removal of **followings and followers**
43
+ - addition/removal of **playlists**
44
+ - addition/removal of **tracks in playlists** (including collaborator info for newly added tracks)
45
+ - **playlists name and description** changes
46
+ - **number of likes** for playlists
47
+ - **number of collaborators** for playlists
48
+ - **profile picture** changes
49
+ - **username** changes
50
+ - **Email notifications** for various events (as listed above)
51
+ - **Attaching changed profile pictures** directly to email notifications
52
+ - **Displaying the profile picture** right in your terminal (if you have `imgcat` installed)
53
+ - Additional functionalities on top of the monitoring mode allowing to display **detailed info about the user**, **list of followers & followings**, **recently played artists** and possibility to **search for users** in Spotify catalog with specific names
54
+ - Ability to **display and export** the list of tracks for a specific playlist (including **Liked Songs** for the user who owns the Spotify access token)
55
+ - **Saving all profile changes** (including playlists) with timestamps to the **CSV file**
56
+ - **Clickable** **Spotify**, **Apple Music**, **YouTube Music**, **Amazon Music**, **Deezer**, **Tidal**, **Genius Lyrics**, **AZLyrics**, **Tekstowo.pl**, **Musixmatch** and **Lyrics.com** search URLs printed in the console and included in email notifications (configurable per service)
57
+ - Support for **four different methods to get a Spotify access token** (`sp_dc cookie`, `desktop client`, `OAuth app`, `OAuth user`)
58
+ - Possibility to **control the running copy** of the script via signals
59
+ - **Functional, procedural Python** (minimal OOP)
59
60
 
60
61
  <p align="center">
61
62
  <img src="https://raw.githubusercontent.com/misiektoja/spotify_profile_monitor/refs/heads/main/assets/spotify_profile_monitor.png" alt="spotify_profile_monitor_screenshot" width="100%"/>
@@ -68,6 +69,7 @@ OSINT tool for real-time monitoring of **Spotify users' activities and profile c
68
69
  2. [Installation](#installation)
69
70
  * [Install from PyPI](#install-from-pypi)
70
71
  * [Manual Installation](#manual-installation)
72
+ * [Upgrading](#upgrading)
71
73
  3. [Quick Start](#quick-start)
72
74
  4. [Configuration](#configuration)
73
75
  * [Configuration File](#configuration-file)
@@ -140,6 +142,17 @@ Alternatively, from the downloaded *[requirements.txt](https://raw.githubusercon
140
142
  pip install -r requirements.txt
141
143
  ```
142
144
 
145
+ <a id="upgrading"></a>
146
+ ### Upgrading
147
+
148
+ To upgrade to the latest version when installed from PyPI:
149
+
150
+ ```sh
151
+ pip install spotify_profile_monitor -U
152
+ ```
153
+
154
+ If you installed manually, download the newest *[spotify_profile_monitor.py](https://raw.githubusercontent.com/misiektoja/spotify_profile_monitor/refs/heads/main/spotify_profile_monitor.py)* file to replace your existing installation.
155
+
143
156
  <a id="quick-start"></a>
144
157
  ## Quick Start
145
158
 
@@ -179,6 +192,8 @@ spotify_profile_monitor --generate-config > spotify_profile_monitor.conf
179
192
 
180
193
  Edit the `spotify_profile_monitor.conf` file and change any desired configuration options (detailed comments are provided for each).
181
194
 
195
+ **New in v2.9:** The configuration file includes options to enable/disable music service URLs (Apple Music, YouTube Music, Amazon Music, Deezer, Tidal) and lyrics service URLs (Genius, AZLyrics, Tekstowo.pl, Musixmatch, Lyrics.com) in console and email outputs.
196
+
182
197
  <a id="spotify-access-token-source"></a>
183
198
  ### Spotify access token source
184
199
 
@@ -690,7 +705,7 @@ Make sure you defined your SMTP settings earlier (see [SMTP settings](#smtp-sett
690
705
  Example email:
691
706
 
692
707
  <p align="center">
693
- <img src="https://raw.githubusercontent.com/misiektoja/spotify_profile_monitor/refs/heads/main/assets/spotify_profile_monitor_email_notifications.png" alt="spotify_profile_monitor_email_notifications" width="80%"/>
708
+ <img src="https://raw.githubusercontent.com/misiektoja/spotify_profile_monitor/refs/heads/main/assets/spotify_profile_monitor_email_notifications.png" alt="spotify_profile_monitor_email_notifications" width="90%"/>
694
709
  </p>
695
710
 
696
711
  <a id="csv-export"></a>
@@ -9,24 +9,25 @@ OSINT tool for real-time monitoring of **Spotify users' activities and profile c
9
9
  <a id="features"></a>
10
10
  ## Features
11
11
 
12
- - Real-time tracking of Spotify user activities and profile changes:
13
- - addition/removal of followings and followers
14
- - addition/removal of playlists
15
- - addition/removal of tracks in playlists (including collaborator info for newly added tracks)
16
- - playlists name and description changes
17
- - number of likes for playlists
18
- - number of collaborators for playlists
19
- - profile picture changes
20
- - username changes
21
- - Email notifications for various events (as listed above)
22
- - Attaching changed profile pictures directly to email notifications
23
- - Displaying the profile picture right in your terminal (if you have `imgcat` installed)
24
- - Additional functionalities on top of the monitoring mode allowing to display detailed info about the user, list of followers & followings, recently played artists and possibility to search for users in Spotify catalog with specific names
25
- - Ability to display and export the list of tracks for a specific playlist (including Liked Songs for the user who owns the Spotify access token)
26
- - Saving all profile changes (including playlists) with timestamps to the CSV file
27
- - Clickable Spotify, Apple Music, YouTube Music and Genius Lyrics search URLs printed in the console & included in email notifications
28
- - Support for four different methods to get a Spotify access token (`sp_dc cookie`, `desktop client`, `OAuth app`, `OAuth user`)
29
- - Possibility to control the running copy of the script via signals
12
+ - **Real-time tracking** of Spotify user activities and profile changes:
13
+ - addition/removal of **followings and followers**
14
+ - addition/removal of **playlists**
15
+ - addition/removal of **tracks in playlists** (including collaborator info for newly added tracks)
16
+ - **playlists name and description** changes
17
+ - **number of likes** for playlists
18
+ - **number of collaborators** for playlists
19
+ - **profile picture** changes
20
+ - **username** changes
21
+ - **Email notifications** for various events (as listed above)
22
+ - **Attaching changed profile pictures** directly to email notifications
23
+ - **Displaying the profile picture** right in your terminal (if you have `imgcat` installed)
24
+ - Additional functionalities on top of the monitoring mode allowing to display **detailed info about the user**, **list of followers & followings**, **recently played artists** and possibility to **search for users** in Spotify catalog with specific names
25
+ - Ability to **display and export** the list of tracks for a specific playlist (including **Liked Songs** for the user who owns the Spotify access token)
26
+ - **Saving all profile changes** (including playlists) with timestamps to the **CSV file**
27
+ - **Clickable** **Spotify**, **Apple Music**, **YouTube Music**, **Amazon Music**, **Deezer**, **Tidal**, **Genius Lyrics**, **AZLyrics**, **Tekstowo.pl**, **Musixmatch** and **Lyrics.com** search URLs printed in the console and included in email notifications (configurable per service)
28
+ - Support for **four different methods to get a Spotify access token** (`sp_dc cookie`, `desktop client`, `OAuth app`, `OAuth user`)
29
+ - Possibility to **control the running copy** of the script via signals
30
+ - **Functional, procedural Python** (minimal OOP)
30
31
 
31
32
  <p align="center">
32
33
  <img src="https://raw.githubusercontent.com/misiektoja/spotify_profile_monitor/refs/heads/main/assets/spotify_profile_monitor.png" alt="spotify_profile_monitor_screenshot" width="100%"/>
@@ -39,6 +40,7 @@ OSINT tool for real-time monitoring of **Spotify users' activities and profile c
39
40
  2. [Installation](#installation)
40
41
  * [Install from PyPI](#install-from-pypi)
41
42
  * [Manual Installation](#manual-installation)
43
+ * [Upgrading](#upgrading)
42
44
  3. [Quick Start](#quick-start)
43
45
  4. [Configuration](#configuration)
44
46
  * [Configuration File](#configuration-file)
@@ -111,6 +113,17 @@ Alternatively, from the downloaded *[requirements.txt](https://raw.githubusercon
111
113
  pip install -r requirements.txt
112
114
  ```
113
115
 
116
+ <a id="upgrading"></a>
117
+ ### Upgrading
118
+
119
+ To upgrade to the latest version when installed from PyPI:
120
+
121
+ ```sh
122
+ pip install spotify_profile_monitor -U
123
+ ```
124
+
125
+ If you installed manually, download the newest *[spotify_profile_monitor.py](https://raw.githubusercontent.com/misiektoja/spotify_profile_monitor/refs/heads/main/spotify_profile_monitor.py)* file to replace your existing installation.
126
+
114
127
  <a id="quick-start"></a>
115
128
  ## Quick Start
116
129
 
@@ -150,6 +163,8 @@ spotify_profile_monitor --generate-config > spotify_profile_monitor.conf
150
163
 
151
164
  Edit the `spotify_profile_monitor.conf` file and change any desired configuration options (detailed comments are provided for each).
152
165
 
166
+ **New in v2.9:** The configuration file includes options to enable/disable music service URLs (Apple Music, YouTube Music, Amazon Music, Deezer, Tidal) and lyrics service URLs (Genius, AZLyrics, Tekstowo.pl, Musixmatch, Lyrics.com) in console and email outputs.
167
+
153
168
  <a id="spotify-access-token-source"></a>
154
169
  ### Spotify access token source
155
170
 
@@ -661,7 +676,7 @@ Make sure you defined your SMTP settings earlier (see [SMTP settings](#smtp-sett
661
676
  Example email:
662
677
 
663
678
  <p align="center">
664
- <img src="https://raw.githubusercontent.com/misiektoja/spotify_profile_monitor/refs/heads/main/assets/spotify_profile_monitor_email_notifications.png" alt="spotify_profile_monitor_email_notifications" width="80%"/>
679
+ <img src="https://raw.githubusercontent.com/misiektoja/spotify_profile_monitor/refs/heads/main/assets/spotify_profile_monitor_email_notifications.png" alt="spotify_profile_monitor_email_notifications" width="90%"/>
665
680
  </p>
666
681
 
667
682
  <a id="csv-export"></a>
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "spotify_profile_monitor"
7
- version = "2.8"
7
+ version = "2.9"
8
8
  description = "Tool implementing real-time tracking of Spotify users activities and profile changes including playlists"
9
9
  readme = "README.md"
10
10
  license = "GPL-3.0-or-later"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: spotify_profile_monitor
3
- Version: 2.8
3
+ Version: 2.9
4
4
  Summary: Tool implementing real-time tracking of Spotify users activities and profile changes including playlists
5
5
  Author-email: Michal Szymanski <misiektoja-pypi@rm-rf.ninja>
6
6
  License-Expression: GPL-3.0-or-later
@@ -38,24 +38,25 @@ OSINT tool for real-time monitoring of **Spotify users' activities and profile c
38
38
  <a id="features"></a>
39
39
  ## Features
40
40
 
41
- - Real-time tracking of Spotify user activities and profile changes:
42
- - addition/removal of followings and followers
43
- - addition/removal of playlists
44
- - addition/removal of tracks in playlists (including collaborator info for newly added tracks)
45
- - playlists name and description changes
46
- - number of likes for playlists
47
- - number of collaborators for playlists
48
- - profile picture changes
49
- - username changes
50
- - Email notifications for various events (as listed above)
51
- - Attaching changed profile pictures directly to email notifications
52
- - Displaying the profile picture right in your terminal (if you have `imgcat` installed)
53
- - Additional functionalities on top of the monitoring mode allowing to display detailed info about the user, list of followers & followings, recently played artists and possibility to search for users in Spotify catalog with specific names
54
- - Ability to display and export the list of tracks for a specific playlist (including Liked Songs for the user who owns the Spotify access token)
55
- - Saving all profile changes (including playlists) with timestamps to the CSV file
56
- - Clickable Spotify, Apple Music, YouTube Music and Genius Lyrics search URLs printed in the console & included in email notifications
57
- - Support for four different methods to get a Spotify access token (`sp_dc cookie`, `desktop client`, `OAuth app`, `OAuth user`)
58
- - Possibility to control the running copy of the script via signals
41
+ - **Real-time tracking** of Spotify user activities and profile changes:
42
+ - addition/removal of **followings and followers**
43
+ - addition/removal of **playlists**
44
+ - addition/removal of **tracks in playlists** (including collaborator info for newly added tracks)
45
+ - **playlists name and description** changes
46
+ - **number of likes** for playlists
47
+ - **number of collaborators** for playlists
48
+ - **profile picture** changes
49
+ - **username** changes
50
+ - **Email notifications** for various events (as listed above)
51
+ - **Attaching changed profile pictures** directly to email notifications
52
+ - **Displaying the profile picture** right in your terminal (if you have `imgcat` installed)
53
+ - Additional functionalities on top of the monitoring mode allowing to display **detailed info about the user**, **list of followers & followings**, **recently played artists** and possibility to **search for users** in Spotify catalog with specific names
54
+ - Ability to **display and export** the list of tracks for a specific playlist (including **Liked Songs** for the user who owns the Spotify access token)
55
+ - **Saving all profile changes** (including playlists) with timestamps to the **CSV file**
56
+ - **Clickable** **Spotify**, **Apple Music**, **YouTube Music**, **Amazon Music**, **Deezer**, **Tidal**, **Genius Lyrics**, **AZLyrics**, **Tekstowo.pl**, **Musixmatch** and **Lyrics.com** search URLs printed in the console and included in email notifications (configurable per service)
57
+ - Support for **four different methods to get a Spotify access token** (`sp_dc cookie`, `desktop client`, `OAuth app`, `OAuth user`)
58
+ - Possibility to **control the running copy** of the script via signals
59
+ - **Functional, procedural Python** (minimal OOP)
59
60
 
60
61
  <p align="center">
61
62
  <img src="https://raw.githubusercontent.com/misiektoja/spotify_profile_monitor/refs/heads/main/assets/spotify_profile_monitor.png" alt="spotify_profile_monitor_screenshot" width="100%"/>
@@ -68,6 +69,7 @@ OSINT tool for real-time monitoring of **Spotify users' activities and profile c
68
69
  2. [Installation](#installation)
69
70
  * [Install from PyPI](#install-from-pypi)
70
71
  * [Manual Installation](#manual-installation)
72
+ * [Upgrading](#upgrading)
71
73
  3. [Quick Start](#quick-start)
72
74
  4. [Configuration](#configuration)
73
75
  * [Configuration File](#configuration-file)
@@ -140,6 +142,17 @@ Alternatively, from the downloaded *[requirements.txt](https://raw.githubusercon
140
142
  pip install -r requirements.txt
141
143
  ```
142
144
 
145
+ <a id="upgrading"></a>
146
+ ### Upgrading
147
+
148
+ To upgrade to the latest version when installed from PyPI:
149
+
150
+ ```sh
151
+ pip install spotify_profile_monitor -U
152
+ ```
153
+
154
+ If you installed manually, download the newest *[spotify_profile_monitor.py](https://raw.githubusercontent.com/misiektoja/spotify_profile_monitor/refs/heads/main/spotify_profile_monitor.py)* file to replace your existing installation.
155
+
143
156
  <a id="quick-start"></a>
144
157
  ## Quick Start
145
158
 
@@ -179,6 +192,8 @@ spotify_profile_monitor --generate-config > spotify_profile_monitor.conf
179
192
 
180
193
  Edit the `spotify_profile_monitor.conf` file and change any desired configuration options (detailed comments are provided for each).
181
194
 
195
+ **New in v2.9:** The configuration file includes options to enable/disable music service URLs (Apple Music, YouTube Music, Amazon Music, Deezer, Tidal) and lyrics service URLs (Genius, AZLyrics, Tekstowo.pl, Musixmatch, Lyrics.com) in console and email outputs.
196
+
182
197
  <a id="spotify-access-token-source"></a>
183
198
  ### Spotify access token source
184
199
 
@@ -690,7 +705,7 @@ Make sure you defined your SMTP settings earlier (see [SMTP settings](#smtp-sett
690
705
  Example email:
691
706
 
692
707
  <p align="center">
693
- <img src="https://raw.githubusercontent.com/misiektoja/spotify_profile_monitor/refs/heads/main/assets/spotify_profile_monitor_email_notifications.png" alt="spotify_profile_monitor_email_notifications" width="80%"/>
708
+ <img src="https://raw.githubusercontent.com/misiektoja/spotify_profile_monitor/refs/heads/main/assets/spotify_profile_monitor_email_notifications.png" alt="spotify_profile_monitor_email_notifications" width="90%"/>
694
709
  </p>
695
710
 
696
711
  <a id="csv-export"></a>
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env python3
2
2
  """
3
3
  Author: Michal Szymanski <misiektoja-github@rm-rf.ninja>
4
- v2.8
4
+ v2.9
5
5
 
6
6
  OSINT tool implementing real-time tracking of Spotify users activities and profile changes including playlists:
7
7
  https://github.com/misiektoja/spotify_profile_monitor/
@@ -19,7 +19,7 @@ spotipy (optional, needed when the token source is set to oauth_app)
19
19
  wcwidth (optional, needed by TRUNCATE_CHARS feature)
20
20
  """
21
21
 
22
- VERSION = "2.8"
22
+ VERSION = "2.9"
23
23
 
24
24
  # ---------------------------
25
25
  # CONFIGURATION SECTION START
@@ -247,6 +247,38 @@ TRUNCATE_CHARS = 0
247
247
  # Value used by signal handlers to increase or decrease profile check interval (SPOTIFY_CHECK_INTERVAL); in seconds
248
248
  SPOTIFY_CHECK_SIGNAL_VALUE = 300 # 5 minutes
249
249
 
250
+ # Whether to show Apple Music URL in console and emails
251
+ ENABLE_APPLE_MUSIC_URL = True
252
+
253
+ # Whether to show YouTube Music URL in console and emails
254
+ ENABLE_YOUTUBE_MUSIC_URL = True
255
+
256
+ # Whether to show Amazon Music URL in console and emails
257
+ ENABLE_AMAZON_MUSIC_URL = False
258
+
259
+ # Whether to show Deezer URL in console and emails
260
+ ENABLE_DEEZER_URL = False
261
+
262
+ # Whether to show Tidal URL in console and emails
263
+ # Note: Tidal requires users to be logged in to their account in the web browser to use the search functionality
264
+ ENABLE_TIDAL_URL = False
265
+
266
+ # Whether to show Genius lyrics URL in console and emails
267
+ ENABLE_GENIUS_LYRICS_URL = True
268
+
269
+ # Whether to show AZLyrics URL in console and emails
270
+ ENABLE_AZLYRICS_URL = False
271
+
272
+ # Whether to show Tekstowo.pl lyrics URL in console and emails
273
+ ENABLE_TEKSTOWO_URL = False
274
+
275
+ # Whether to show Musixmatch lyrics URL in console and emails
276
+ # Note: Musixmatch requires users to be logged in to their account in the web browser to use the search functionality
277
+ ENABLE_MUSIXMATCH_URL = False
278
+
279
+ # Whether to show Lyrics.com lyrics URL in console and emails
280
+ ENABLE_LYRICS_COM_URL = False
281
+
250
282
  # ---------------------------------------------------------------------
251
283
 
252
284
  # The section below is used when the token source is set to 'cookie'
@@ -542,6 +574,16 @@ DISABLE_LOGGING = False
542
574
  HORIZONTAL_LINE = 0
543
575
  CLEAR_SCREEN = False
544
576
  SPOTIFY_CHECK_SIGNAL_VALUE = 0
577
+ ENABLE_APPLE_MUSIC_URL = False
578
+ ENABLE_YOUTUBE_MUSIC_URL = False
579
+ ENABLE_AMAZON_MUSIC_URL = False
580
+ ENABLE_DEEZER_URL = False
581
+ ENABLE_TIDAL_URL = False
582
+ ENABLE_GENIUS_LYRICS_URL = False
583
+ ENABLE_AZLYRICS_URL = False
584
+ ENABLE_TEKSTOWO_URL = False
585
+ ENABLE_MUSIXMATCH_URL = False
586
+ ENABLE_LYRICS_COM_URL = False
545
587
  TOKEN_MAX_RETRIES = 0
546
588
  TOKEN_RETRY_TIMEOUT = 0.0
547
589
  SECRET_CIPHER_DICT = {}
@@ -1292,17 +1334,126 @@ def reload_secrets_signal_handler(sig, frame):
1292
1334
  print_cur_ts("Timestamp:\t\t\t")
1293
1335
 
1294
1336
 
1295
- # Returns Apple & Genius search URLs for specified track
1337
+ # Returns Apple & lyrics search URLs for specified track
1296
1338
  def get_apple_genius_search_urls(artist, track):
1297
- genius_search_string = f"{artist} {track}"
1298
- youtube_music_search_string = quote_plus(f"{artist} {track}")
1299
- if re.search(re_search_str, genius_search_string, re.IGNORECASE):
1300
- genius_search_string = re.sub(re_replace_str, '', genius_search_string, flags=re.IGNORECASE)
1301
- apple_search_string = quote(f"{artist} {track}")
1339
+ spotify_search_string = f"{artist} {track}"
1340
+ youtube_music_search_string = quote_plus(spotify_search_string)
1341
+ # Clean search string for lyrics services (remove remaster, extended, etc.)
1342
+ lyrics_search_string = spotify_search_string
1343
+ if re.search(re_search_str, lyrics_search_string, re.IGNORECASE):
1344
+ lyrics_search_string = re.sub(re_replace_str, '', lyrics_search_string, flags=re.IGNORECASE)
1345
+ apple_search_string = quote(spotify_search_string)
1302
1346
  apple_search_url = f"https://music.apple.com/pl/search?term={apple_search_string}"
1303
- genius_search_url = f"https://genius.com/search?q={quote_plus(genius_search_string)}"
1347
+ genius_search_url = f"https://genius.com/search?q={quote_plus(lyrics_search_string)}"
1348
+ azlyrics_search_url = f"https://www.azlyrics.com/search/?q={quote_plus(lyrics_search_string)}"
1349
+ tekstowo_search_url = f"https://www.tekstowo.pl/szukaj,{quote_plus(lyrics_search_string)}.html"
1350
+ musixmatch_search_url = f"https://www.musixmatch.com/search?query={quote_plus(lyrics_search_string)}"
1351
+ lyrics_com_search_url = f"https://www.lyrics.com/serp.php?st={quote_plus(lyrics_search_string)}&qtype=1"
1304
1352
  youtube_music_search_url = f"https://music.youtube.com/search?q={youtube_music_search_string}"
1305
- return apple_search_url, genius_search_url, youtube_music_search_url
1353
+ amazon_music_search_url = f"https://music.amazon.com/search/{quote_plus(spotify_search_string)}"
1354
+ deezer_search_url = f"https://www.deezer.com/search/{quote_plus(spotify_search_string)}"
1355
+ tidal_search_url = f"https://tidal.com/search?q={quote_plus(spotify_search_string)}"
1356
+ return apple_search_url, genius_search_url, azlyrics_search_url, tekstowo_search_url, musixmatch_search_url, lyrics_com_search_url, youtube_music_search_url, amazon_music_search_url, deezer_search_url, tidal_search_url
1357
+
1358
+
1359
+ # Formats lyrics URLs for console output based on configuration
1360
+ def format_lyrics_urls_console(genius_url, azlyrics_url, tekstowo_url, musixmatch_url, lyrics_com_url):
1361
+ lines = []
1362
+ if ENABLE_GENIUS_LYRICS_URL:
1363
+ lines.append(f"Genius lyrics URL: {genius_url}")
1364
+ if ENABLE_AZLYRICS_URL:
1365
+ lines.append(f"AZLyrics URL: {azlyrics_url}")
1366
+ if ENABLE_TEKSTOWO_URL:
1367
+ lines.append(f"Tekstowo.pl URL: {tekstowo_url}")
1368
+ if ENABLE_MUSIXMATCH_URL:
1369
+ lines.append(f"Musixmatch URL: {musixmatch_url}")
1370
+ if ENABLE_LYRICS_COM_URL:
1371
+ lines.append(f"Lyrics.com URL: {lyrics_com_url}")
1372
+ return "\n".join(lines) if lines else ""
1373
+
1374
+
1375
+ # Formats lyrics URLs for plain text email body based on configuration
1376
+ def format_lyrics_urls_email_text(genius_url, azlyrics_url, tekstowo_url, musixmatch_url, lyrics_com_url):
1377
+ lines = []
1378
+ if ENABLE_GENIUS_LYRICS_URL:
1379
+ lines.append(f"Genius lyrics URL: {genius_url}")
1380
+ if ENABLE_AZLYRICS_URL:
1381
+ lines.append(f"AZLyrics URL: {azlyrics_url}")
1382
+ if ENABLE_TEKSTOWO_URL:
1383
+ lines.append(f"Tekstowo.pl URL: {tekstowo_url}")
1384
+ if ENABLE_MUSIXMATCH_URL:
1385
+ lines.append(f"Musixmatch URL: {musixmatch_url}")
1386
+ if ENABLE_LYRICS_COM_URL:
1387
+ lines.append(f"Lyrics.com URL: {lyrics_com_url}")
1388
+ return "\n".join(lines) if lines else ""
1389
+
1390
+
1391
+ # Formats lyrics URLs for HTML email body based on configuration
1392
+ def format_lyrics_urls_email_html(genius_url, azlyrics_url, tekstowo_url, musixmatch_url, lyrics_com_url, artist, track):
1393
+ lines = []
1394
+ escaped_artist = escape(artist)
1395
+ escaped_track = escape(track)
1396
+ if ENABLE_GENIUS_LYRICS_URL:
1397
+ lines.append(f'Genius lyrics URL: <a href="{genius_url}">{escaped_artist} - {escaped_track}</a>')
1398
+ if ENABLE_AZLYRICS_URL:
1399
+ lines.append(f'AZLyrics URL: <a href="{azlyrics_url}">{escaped_artist} - {escaped_track}</a>')
1400
+ if ENABLE_TEKSTOWO_URL:
1401
+ lines.append(f'Tekstowo.pl URL: <a href="{tekstowo_url}">{escaped_artist} - {escaped_track}</a>')
1402
+ if ENABLE_MUSIXMATCH_URL:
1403
+ lines.append(f'Musixmatch URL: <a href="{musixmatch_url}">{escaped_artist} - {escaped_track}</a>')
1404
+ if ENABLE_LYRICS_COM_URL:
1405
+ lines.append(f'Lyrics.com URL: <a href="{lyrics_com_url}">{escaped_artist} - {escaped_track}</a>')
1406
+ return "<br>".join(lines) if lines else ""
1407
+
1408
+
1409
+ # Formats music service URLs for console output based on configuration
1410
+ def format_music_urls_console(apple_music_url, youtube_music_url, amazon_music_url, deezer_url, tidal_url):
1411
+ lines = []
1412
+ if ENABLE_APPLE_MUSIC_URL:
1413
+ lines.append(f"Apple Music URL: {apple_music_url}")
1414
+ if ENABLE_YOUTUBE_MUSIC_URL:
1415
+ lines.append(f"YouTube Music URL: {youtube_music_url}")
1416
+ if ENABLE_AMAZON_MUSIC_URL:
1417
+ lines.append(f"Amazon Music URL: {amazon_music_url}")
1418
+ if ENABLE_DEEZER_URL:
1419
+ lines.append(f"Deezer URL: {deezer_url}")
1420
+ if ENABLE_TIDAL_URL:
1421
+ lines.append(f"Tidal URL: {tidal_url}")
1422
+ return "\n".join(lines) if lines else ""
1423
+
1424
+
1425
+ # Formats music service URLs for plain text email body based on configuration
1426
+ def format_music_urls_email_text(apple_music_url, youtube_music_url, amazon_music_url, deezer_url, tidal_url):
1427
+ lines = []
1428
+ if ENABLE_APPLE_MUSIC_URL:
1429
+ lines.append(f"Apple Music URL: {apple_music_url}")
1430
+ if ENABLE_YOUTUBE_MUSIC_URL:
1431
+ lines.append(f"YouTube Music URL: {youtube_music_url}")
1432
+ if ENABLE_AMAZON_MUSIC_URL:
1433
+ lines.append(f"Amazon Music URL: {amazon_music_url}")
1434
+ if ENABLE_DEEZER_URL:
1435
+ lines.append(f"Deezer URL: {deezer_url}")
1436
+ if ENABLE_TIDAL_URL:
1437
+ lines.append(f"Tidal URL: {tidal_url}")
1438
+ return "\n".join(lines) if lines else ""
1439
+
1440
+
1441
+ # Formats music service URLs for HTML email body based on configuration
1442
+ def format_music_urls_email_html(apple_music_url, youtube_music_url, amazon_music_url, deezer_url, tidal_url, artist, track):
1443
+ lines = []
1444
+ escaped_artist = escape(artist)
1445
+ escaped_track = escape(track)
1446
+ if ENABLE_APPLE_MUSIC_URL:
1447
+ lines.append(f'Apple Music URL: <a href="{apple_music_url}">{escaped_artist} - {escaped_track}</a>')
1448
+ if ENABLE_YOUTUBE_MUSIC_URL:
1449
+ lines.append(f'YouTube Music URL: <a href="{youtube_music_url}">{escaped_artist} - {escaped_track}</a>')
1450
+ if ENABLE_AMAZON_MUSIC_URL:
1451
+ lines.append(f'Amazon Music URL: <a href="{amazon_music_url}">{escaped_artist} - {escaped_track}</a>')
1452
+ if ENABLE_DEEZER_URL:
1453
+ lines.append(f'Deezer URL: <a href="{deezer_url}">{escaped_artist} - {escaped_track}</a>')
1454
+ if ENABLE_TIDAL_URL:
1455
+ lines.append(f'Tidal URL: <a href="{tidal_url}">{escaped_artist} - {escaped_track}</a>')
1456
+ return "<br>".join(lines) if lines else ""
1306
1457
 
1307
1458
 
1308
1459
  # Extracts Spotify ID from URI or URL and return cleaned name
@@ -3931,7 +4082,8 @@ def spotify_profile_monitor_uri(user_uri_id, csv_file_name, playlists_to_skip):
3931
4082
 
3932
4083
  out = f"Monitoring user {user_uri_id}"
3933
4084
  print(out)
3934
- print("-" * len(out))
4085
+ # print("-" * len(out))
4086
+ print("─" * HORIZONTAL_LINE)
3935
4087
 
3936
4088
  try:
3937
4089
  if TOKEN_SOURCE == "client":
@@ -3977,9 +4129,10 @@ def spotify_profile_monitor_uri(user_uri_id, csv_file_name, playlists_to_skip):
3977
4129
 
3978
4130
  if user_info:
3979
4131
  if TOKEN_SOURCE == "oauth_app":
3980
- print(f"Token belongs to:\t\t{user_info.get('client_id', '')} (via {TOKEN_SOURCE})\n")
4132
+ print(f"Token belongs to:\t\t{user_info.get('client_id', '')} (via {TOKEN_SOURCE})")
3981
4133
  else:
3982
- print(f"Token belongs to:\t\t{user_info.get('display_name', '')} (via {TOKEN_SOURCE})\n\t\t\t\t[ {user_info.get('spotify_url')} ]\n")
4134
+ print(f"Token belongs to:\t\t{user_info.get('display_name', '')} (via {TOKEN_SOURCE})\n\t\t\t\t[ {user_info.get('spotify_url')} ]")
4135
+ print("─" * HORIZONTAL_LINE)
3983
4136
 
3984
4137
  username = sp_user_data["sp_username"]
3985
4138
  image_url = sp_user_data["sp_user_image_url"]
@@ -4792,12 +4945,35 @@ def spotify_profile_monitor_uri(user_uri_id, csv_file_name, playlists_to_skip):
4792
4945
 
4793
4946
  for f_dict in added_tracks:
4794
4947
  if "artist" in f_dict and "track" in f_dict:
4795
- apple_search_url, genius_search_url, youtube_music_search_url = get_apple_genius_search_urls(f_dict["artist"], f_dict["track"])
4948
+ apple_search_url, genius_search_url, azlyrics_search_url, tekstowo_search_url, musixmatch_search_url, lyrics_com_search_url, youtube_music_search_url, amazon_music_search_url, deezer_search_url, tidal_search_url = get_apple_genius_search_urls(f_dict["artist"], f_dict["track"])
4796
4949
  tempuri = f'spotify:user:{f_dict["added_by_id"]}'
4797
- added_track = f'- {f_dict["artist"]} - {f_dict["track"]} [ {get_date_from_ts(f_dict["added_at"])}, {f_dict["added_by"]} ]\n[ Spotify URL: {spotify_convert_uri_to_url(f_dict["uri"])} ]\n[ Apple Music URL: {apple_search_url} ]\n[ YouTube Music URL: {youtube_music_search_url} ]\n[ Genius URL: {genius_search_url} ]\n[ Collaborator URL: {spotify_convert_uri_to_url(tempuri)} ]\n\n'
4798
- p_message_added_tracks += added_track
4950
+ music_urls_output = format_music_urls_console(apple_search_url, youtube_music_search_url, amazon_music_search_url, deezer_search_url, tidal_search_url)
4951
+ lyrics_urls_output = format_lyrics_urls_console(genius_search_url, azlyrics_search_url, tekstowo_search_url, musixmatch_search_url, lyrics_com_search_url)
4952
+ music_urls_text = format_music_urls_email_text(apple_search_url, youtube_music_search_url, amazon_music_search_url, deezer_search_url, tidal_search_url)
4953
+ lyrics_urls_text = format_lyrics_urls_email_text(genius_search_url, azlyrics_search_url, tekstowo_search_url, musixmatch_search_url, lyrics_com_search_url)
4954
+ added_track_console = f'- {f_dict["artist"]} - {f_dict["track"]} [ {get_date_from_ts(f_dict["added_at"])}, {f_dict["added_by"]} ]\n[ Spotify URL: {spotify_convert_uri_to_url(f_dict["uri"])} ]\n'
4955
+ if music_urls_output:
4956
+ for line in music_urls_output.split("\n"):
4957
+ if line:
4958
+ added_track_console += f"[ {line} ]\n"
4959
+ if lyrics_urls_output:
4960
+ for line in lyrics_urls_output.split("\n"):
4961
+ if line:
4962
+ added_track_console += f"[ {line} ]\n"
4963
+ added_track_console += f'[ Collaborator URL: {spotify_convert_uri_to_url(tempuri)} ]\n\n'
4964
+ added_track_email = f'- {f_dict["artist"]} - {f_dict["track"]} [ {get_date_from_ts(f_dict["added_at"])}, {f_dict["added_by"]} ]\n[ Spotify URL: {spotify_convert_uri_to_url(f_dict["uri"])} ]\n'
4965
+ if music_urls_text:
4966
+ for line in music_urls_text.split("\n"):
4967
+ if line:
4968
+ added_track_email += f"[ {line} ]\n"
4969
+ if lyrics_urls_text:
4970
+ for line in lyrics_urls_text.split("\n"):
4971
+ if line:
4972
+ added_track_email += f"[ {line} ]\n"
4973
+ added_track_email += f'[ Collaborator URL: {spotify_convert_uri_to_url(tempuri)} ]\n\n'
4974
+ p_message_added_tracks += added_track_email
4799
4975
  added_at_dt = f_dict['added_at']
4800
- print(added_track, end="")
4976
+ print(added_track_console, end="")
4801
4977
  try:
4802
4978
  if csv_file_name:
4803
4979
  write_csv_entry(csv_file_name, convert_to_local_naive(added_at_dt), "Added Track", p_name, f_dict['added_by'], f_dict["artist"] + " - " + f_dict["track"])
@@ -4810,11 +4986,34 @@ def spotify_profile_monitor_uri(user_uri_id, csv_file_name, playlists_to_skip):
4810
4986
 
4811
4987
  for f_dict in removed_tracks:
4812
4988
  if "artist" in f_dict and "track" in f_dict:
4813
- apple_search_url, genius_search_url, youtube_music_search_url = get_apple_genius_search_urls(f_dict["artist"], f_dict["track"])
4989
+ apple_search_url, genius_search_url, azlyrics_search_url, tekstowo_search_url, musixmatch_search_url, lyrics_com_search_url, youtube_music_search_url, amazon_music_search_url, deezer_search_url, tidal_search_url = get_apple_genius_search_urls(f_dict["artist"], f_dict["track"])
4814
4990
  tempuri = f'spotify:user:{f_dict["added_by_id"]}'
4815
- removed_track = f'- {f_dict["artist"]} - {f_dict["track"]} [ {get_date_from_ts(f_dict["added_at"])}, {f_dict["added_by"]} ]\n[ Spotify URL: {spotify_convert_uri_to_url(f_dict["uri"])} ]\n[ Apple Music URL: {apple_search_url} ]\n[ YouTube Music URL: {youtube_music_search_url} ]\n[ Genius URL: {genius_search_url} ]\n[ Collaborator URL: {spotify_convert_uri_to_url(tempuri)} ]\n\n'
4816
- p_message_removed_tracks += removed_track
4817
- print(removed_track, end="")
4991
+ music_urls_output = format_music_urls_console(apple_search_url, youtube_music_search_url, amazon_music_search_url, deezer_search_url, tidal_search_url)
4992
+ lyrics_urls_output = format_lyrics_urls_console(genius_search_url, azlyrics_search_url, tekstowo_search_url, musixmatch_search_url, lyrics_com_search_url)
4993
+ music_urls_text = format_music_urls_email_text(apple_search_url, youtube_music_search_url, amazon_music_search_url, deezer_search_url, tidal_search_url)
4994
+ lyrics_urls_text = format_lyrics_urls_email_text(genius_search_url, azlyrics_search_url, tekstowo_search_url, musixmatch_search_url, lyrics_com_search_url)
4995
+ removed_track_console = f'- {f_dict["artist"]} - {f_dict["track"]} [ {get_date_from_ts(f_dict["added_at"])}, {f_dict["added_by"]} ]\n[ Spotify URL: {spotify_convert_uri_to_url(f_dict["uri"])} ]\n'
4996
+ if music_urls_output:
4997
+ for line in music_urls_output.split("\n"):
4998
+ if line:
4999
+ removed_track_console += f"[ {line} ]\n"
5000
+ if lyrics_urls_output:
5001
+ for line in lyrics_urls_output.split("\n"):
5002
+ if line:
5003
+ removed_track_console += f"[ {line} ]\n"
5004
+ removed_track_console += f'[ Collaborator URL: {spotify_convert_uri_to_url(tempuri)} ]\n\n'
5005
+ removed_track_email = f'- {f_dict["artist"]} - {f_dict["track"]} [ {get_date_from_ts(f_dict["added_at"])}, {f_dict["added_by"]} ]\n[ Spotify URL: {spotify_convert_uri_to_url(f_dict["uri"])} ]\n'
5006
+ if music_urls_text:
5007
+ for line in music_urls_text.split("\n"):
5008
+ if line:
5009
+ removed_track_email += f"[ {line} ]\n"
5010
+ if lyrics_urls_text:
5011
+ for line in lyrics_urls_text.split("\n"):
5012
+ if line:
5013
+ removed_track_email += f"[ {line} ]\n"
5014
+ removed_track_email += f'[ Collaborator URL: {spotify_convert_uri_to_url(tempuri)} ]\n\n'
5015
+ p_message_removed_tracks += removed_track_email
5016
+ print(removed_track_console, end="")
4818
5017
  try:
4819
5018
  if csv_file_name:
4820
5019
  write_csv_entry(csv_file_name, now_local_naive(), "Removed Track", p_name, f_dict["artist"] + " - " + f_dict["track"], "")