|
|
|
09-15-2013, 01:46 PM
|
#1
|
Human being with feelings
Join Date: Aug 2012
Location: Finland
Posts: 2,668
|
ReaScript: Rename tracks to source file name - keep trailing digits
This one was missing (Reaper drops the last digits when importing tracks)
Rename tracks to (active)take source filename (without file extension) and keep trailing digits:
Code:
# Rename tracks to take source filename (without file extension)
# take = first item's active take
from reaper_python import *
from contextlib import contextmanager
import os
@contextmanager
def undoable(message):
RPR_Undo_BeginBlock2(0)
try:
yield
finally:
RPR_Undo_EndBlock2(0, message, -1)
with undoable("Rename tracks to source file name"):
def msg(m):
RPR_ShowConsoleMsg(m)
def renameToSourceFileName():
trackCount = RPR_CountSelectedTracks(0)
if trackCount < 1:
msg("")
msg("Select tracks first")
return
for i in range(trackCount):
trackId = RPR_GetSelectedTrack(0, i)
itemCount = RPR_CountTrackMediaItems(trackId)
if itemCount == 0:
continue
itemId = RPR_GetTrackMediaItem(trackId, 0) # get id from first item in track
takeId = RPR_GetActiveTake(itemId) # get id from active take in item
takeSource = RPR_GetMediaItemTake_Source(takeId)
fullPath = str(RPR_GetMediaSourceFileName(takeSource, "", 512)[1])
if fullPath == "": # ignore in-project MIDI
continue
fileName = os.path.split(fullPath)[-1][:-4] # get filename and remove file extension
RPR_GetSetMediaTrackInfo_String(trackId, "P_NAME", fileName, 1)
renameToSourceFileName()
|
|
|
03-06-2014, 12:38 AM
|
#2
|
Human being with feelings
Join Date: Mar 2013
Posts: 463
|
thanks, this is useful
|
|
|
08-21-2014, 07:41 AM
|
#3
|
Human being with feelings
Join Date: Aug 2012
Location: Finland
Posts: 2,668
|
EEL version is here (this was requested): - unzip to your computer
- download from the Action List
https://stash.reaper.fm/21561/Set%20t...tension%29.zip
Edit/Zip updated: If the first item on a track is "In-project MIDI item" -> the script uses "active take name" for renaming the track.
Last edited by spk77; 08-21-2014 at 11:34 AM.
|
|
|
08-21-2014, 07:58 AM
|
#4
|
Human being with feelings
Join Date: Oct 2007
Location: Lincoln, UK
Posts: 7,942
|
Quote:
Originally Posted by spk77
|
Nice one spk77, I'll add that to the cache
>
|
|
|
08-21-2014, 09:16 AM
|
#5
|
Human being with feelings
Join Date: Sep 2013
Location: La Habana, Cuba
Posts: 79
|
spk77, your PM inbox is full...
Sorry, the .py works just fine, but i was testing it on midi items!!!
then i opened it and saw a line that made think about the source files,
I thought it takes the name from the active take, but it is from the souce file
could you make another that renames the tracks from the Active Take Name, so it
could also rename Midi tracks, that would be the best tool ever!!!
This is my ideal workflow
1. import audio and midi to reaper
2. apply my track templates via sws resources window
3. run your script to get the names back!!!
cool ehh... fast mix setup... greetings...
PS: thanks for the EEL !!!
do you program this things on a rocket??? that was fast!!!
|
|
|
08-21-2014, 10:23 AM
|
#6
|
Human being with feelings
Join Date: Aug 2012
Location: Finland
Posts: 2,668
|
Quote:
Originally Posted by luiso
Sorry, the .py works just fine, but i was testing it on midi items!!!
then i opened it and saw a line that made think about the source files,
I thought it takes the name from the active take, but it is from the souce file
could you make another that renames the tracks from the Active Take Name, so it
could also rename Midi tracks, that would be the best tool ever!!!
This is my ideal workflow
1. import audio and midi to reaper
2. apply my track templates via sws resources window
3. run your script to get the names back!!!
cool ehh... fast mix setup... greetings...
PS: thanks for the EEL !!!
do you program this things on a rocket??? that was fast!!!
|
Hi,
Yes, in-project MIDI doesn't have a source file (MIDI event info is "integrated" into RPP files). It should be quite easy to modify it so that it takes the names from active takes. I'll modify it and post it here
|
|
|
08-21-2014, 10:57 AM
|
#8
|
Human being with feelings
Join Date: Nov 2010
Posts: 2,436
|
The script that renames track to source name is nice but I agree with luiso that in case there is no source (i.e. MIDI items), it should just use take name.
|
|
|
08-21-2014, 11:29 AM
|
#9
|
Human being with feelings
Join Date: Aug 2012
Location: Finland
Posts: 2,668
|
Quote:
Originally Posted by Breeder
The script that renames track to source name is nice but I agree with luiso that in case there is no source (i.e. MIDI items), it should just use take name.
|
Ok, now the script in post#3 should do that
|
|
|
08-21-2014, 12:38 PM
|
#10
|
Human being with feelings
Join Date: Sep 2013
Location: La Habana, Cuba
Posts: 79
|
spk77...
as i said, the best tool ever!!!
sorry for my language but, this is so fucking gooooooddddd
you just saved me from countless typing hours yhat i will
use for bears and girls :P
even if i edit the items and glue them, move others from other tracks, etc... the first one steel gives the name to the track!!!
this should be included by default man...
I will continue testing it and report to you
but so far.... REAL good ..... thanks again man
|
|
|
08-21-2014, 12:46 PM
|
#11
|
Human being with feelings
Join Date: Aug 2012
Location: Finland
Posts: 2,668
|
Quote:
Originally Posted by luiso
as i said, the best tool ever!!!
sorry for my language but, this is so fucking gooooooddddd
you just saved me from countless typing hours yhat i will
use for bears and girls :P
even if i edit the items and glue them, move others from other tracks, etc... the first one steel gives the name to the track!!!
this should be included by default man...
I will continue testing it and report to you
but so far.... REAL good ..... thanks again man
|
Glad it worked!
|
|
|
08-21-2014, 02:30 PM
|
#12
|
Human being with feelings
Join Date: Oct 2007
Location: Lincoln, UK
Posts: 7,942
|
Quote:
Originally Posted by luiso
as i said, the best tool ever!!!
...
you just saved me from countless typing hours yhat i will
use for bears and girls :P
...
|
I'll never get to be an alpha male, they keep moving the goal-posts..!
>
|
|
|
08-21-2014, 06:57 PM
|
#13
|
Human being with feelings
Join Date: Sep 2013
Location: La Habana, Cuba
Posts: 79
|
Hi planetnine
"I'll never get to be an alpha male, they keep moving the goal-posts..! "
sorry man but my English is not so good to get the joke,
must be cause I wrote BEER wrong... but girls was OK...
>
.
|
|
|
08-22-2014, 02:02 AM
|
#14
|
Human being with feelings
Join Date: Oct 2007
Location: Lincoln, UK
Posts: 7,942
|
I realised afterwards it must be BEERS
I thought maybe wrestling BEARS was the latest masculine pursuit, I couldn't compete with that!
>
|
|
|
08-22-2014, 07:53 AM
|
#15
|
Human being with feelings
Join Date: Sep 2013
Location: La Habana, Cuba
Posts: 79
|
"I thought maybe wrestling BEARS was the latest masculine pursuit, I couldn't compete with that!"
NO, NO... good music, BEERS and girls...
but now that i think about it, after some beers some mulata girls can turn wild and you have to gentle wrestle with them
cheer from the caribbean!!!!
|
|
|
05-07-2021, 04:48 AM
|
#16
|
Human being with feelings
Join Date: Jul 2014
Location: Turkey
Posts: 233
|
Quote:
Originally Posted by spk77
EEL version is here (this was requested): - unzip to your computer
- download from the Action List
https://stash.reaper.fm/21561/Set%20...tension%29.zip
Edit/Zip updated: If the first item on a track is "In-project MIDI item" -> the script uses "active take name" for renaming the track.
|
I couldn't managed to delete the file extension, how can I do that?
Last edited by ertugrulgul; 05-07-2021 at 04:59 AM.
|
|
|
12-17-2023, 11:18 AM
|
#17
|
Human being with feelings
Join Date: Jun 2020
Posts: 7
|
does anyone know if this can work with Selected Item rather than 1st item?
|
|
|
Thread Tools |
|
Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -7. The time now is 05:22 AM.
|