Comments (13)
Renaming is always been quite Challenging since it cannot be done without implementing API's. Even with them, it will be difficult to handle few names which cannot be completely automated. I need to check upon how to handle these.
from cinesync.
Happy days mate cheers I did do a quick search online apparently the mv command works to rename the symlink. Would it be possible to run filebot on the folder to see if that works lol
from cinesync.
you can manually rename the files using mv, but that method will be hard for all files since you have to do it one by one :). Also can you explain the second method,? Never came across with such thing
from cinesync.
Yeah to hell one by one renaming lol and filebot it's a tool used for renaming if files to make it easier for media parsers to get the correct metadata. It's a paid for product but could be easily added to your script if a user already has it installed.
from cinesync.
I hope there is a demo version of it, I'll check the working on ubuntu and add it accordingly.
from cinesync.
I'll happy get you a years license if you want lol
from cinesync.
I'm learning on how it is implemented on sonarr :). It just picks the right name all time.
from cinesync.
Haha that it does but if needed I'll send you my filebot licence via email ;)
from cinesync.
I'm just worried about the users who doesn't have it
from cinesync.
You could possibly do something like this in python got help from chatgpt lol
import os
import re
import requests
# Function to query TMDb API for TV series
def query_tmdb_tv(api_key, query):
url = "https://api.themoviedb.org/3/search/tv"
params = {
'api_key': api_key,
'query': query
}
response = requests.get(url, params=params)
if response.status_code == 200:
return response.json()
else:
return None
# Function to query TMDb API for specific episode details
def query_tmdb_episode(api_key, tv_id, season_number, episode_number):
url = f"https://api.themoviedb.org/3/tv/{tv_id}/season/{season_number}/episode/{episode_number}"
params = {
'api_key': api_key
}
response = requests.get(url, params=params)
if response.status_code == 200:
return response.json()
else:
return None
# Function to extract series name, season number, and episode number from file name
def extract_info(file_name):
pattern = re.compile(r"(.+?)[. _-]+[sS](\d+)[eE](\d+)")
match = pattern.match(file_name)
if match:
series_name = match.group(1).replace('.', ' ').replace('_', ' ').replace('-', ' ').strip()
season_number = int(match.group(2))
episode_number = int(match.group(3))
return series_name, season_number, episode_number
return None, None, None
# Main function
def main():
api_key = 'YOUR_TMDB_API_KEY'
media_folder = 'path/to/your/media/files'
for file_name in os.listdir(media_folder):
if os.path.isfile(os.path.join(media_folder, file_name)):
series_name, season_number, episode_number = extract_info(file_name)
if series_name and season_number and episode_number:
print(f"Querying TMDb for TV series: {series_name}, Season: {season_number}, Episode: {episode_number}")
result = query_tmdb_tv(api_key, series_name)
if result and result['results']:
# Get the first result from the list
series_info = result['results'][0]
tv_id = series_info['id']
episode_info = query_tmdb_episode(api_key, tv_id, season_number, episode_number)
if episode_info:
print(f"Series: {series_info['name']}")
print(f"Season: {season_number}, Episode: {episode_number}")
# Print the episode title
print(f"Episode Title: {episode_info['name']}")
print(f"Air Date: {episode_info['air_date']}")
print(f"Overview: {episode_info['overview']}")
else:
print(f"No episode information found for: {series_name}, Season: {season_number}, Episode: {episode_number}")
else:
print(f"No results found for: {series_name}")
else:
print(f"File name does not match expected pattern: {file_name}")
if __name__ == "__main__":
main()
from cinesync.
You could possibly do something like this in python got help from chatgpt lol
import os import re import requests # Function to query TMDb API for TV series def query_tmdb_tv(api_key, query): url = "https://api.themoviedb.org/3/search/tv" params = { 'api_key': api_key, 'query': query } response = requests.get(url, params=params) if response.status_code == 200: return response.json() else: return None # Function to query TMDb API for specific episode details def query_tmdb_episode(api_key, tv_id, season_number, episode_number): url = f"https://api.themoviedb.org/3/tv/{tv_id}/season/{season_number}/episode/{episode_number}" params = { 'api_key': api_key } response = requests.get(url, params=params) if response.status_code == 200: return response.json() else: return None # Function to extract series name, season number, and episode number from file name def extract_info(file_name): pattern = re.compile(r"(.+?)[. _-]+[sS](\d+)[eE](\d+)") match = pattern.match(file_name) if match: series_name = match.group(1).replace('.', ' ').replace('_', ' ').replace('-', ' ').strip() season_number = int(match.group(2)) episode_number = int(match.group(3)) return series_name, season_number, episode_number return None, None, None # Main function def main(): api_key = 'YOUR_TMDB_API_KEY' media_folder = 'path/to/your/media/files' for file_name in os.listdir(media_folder): if os.path.isfile(os.path.join(media_folder, file_name)): series_name, season_number, episode_number = extract_info(file_name) if series_name and season_number and episode_number: print(f"Querying TMDb for TV series: {series_name}, Season: {season_number}, Episode: {episode_number}") result = query_tmdb_tv(api_key, series_name) if result and result['results']: # Get the first result from the list series_info = result['results'][0] tv_id = series_info['id'] episode_info = query_tmdb_episode(api_key, tv_id, season_number, episode_number) if episode_info: print(f"Series: {series_info['name']}") print(f"Season: {season_number}, Episode: {episode_number}") # Print the episode title print(f"Episode Title: {episode_info['name']}") print(f"Air Date: {episode_info['air_date']}") print(f"Overview: {episode_info['overview']}") else: print(f"No episode information found for: {series_name}, Season: {season_number}, Episode: {episode_number}") else: print(f"No results found for: {series_name}") else: print(f"File name does not match expected pattern: {file_name}") if __name__ == "__main__": main()
need to check this, can you try it locally ?
from cinesync.
Not at the moment as I'm not at home but I will later when I'm home again
from cinesync.
I'll check on this tomorrow.
from cinesync.
Related Issues (9)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cinesync.