Before some rapture their aneurysms, let's get some terminology right, a hack is
So if you won't perform a craniotomy on yourself (read: not crazy and not desperate enough), quit reading this post and go back; for the adventurous kind, continues. All of the below assumes you have the "single season" mod, otherwise things get messy very fast and nor worth dealing with.
I had a particular problem where the pilot episode of a series was SD while the remainder of the series was perfectly good HD, and 'Fab was stuck analysing the pilot, even with the single season mod. It's pretty easy to infer, that whatever list of episodes is given to 'Fab's engine, the engine will take the first entry in the list and analyse that. Knowing that, we can perform some brain surgery on 'Fab to re-wire its brain. We will be operating on
file, so back it up (don't you wish you could do that with a real patient?) before you start hacking at it! Having done that, here are some hacks in increasing difficulty levels.The function in the above-mentioned file that is responsible for returning the list of episodes is called "get_episodes_info," and we don't need to change anything major in it, just change what it signals to the cerebrum of 'Fab.
Lobotomy Level (easy, anyone can do it)
The simplest way to get 'Fab to analyse something other than the first episode in a season, is to reverse the list of episodes and get 'Fab to analyse the last episode of the season (obviously this breaks if Amazon insert junk like specials etc in the main listing of the episodes instead of the specials, but that's why this is a hack (see terminology) and not a fix). You will observe that the aforementioned function returns a list of episodes on line 174 as
so to reverse that array, we don't need to do anything major, just literally reverse that array in place, and luckily, there's a python way of doing it:
That is all: you literally have to add six characters and you get a list in reverse order.
Of course the additional benefit of this hack is that if you're only downloading the latest episode of a series and are careless like me, not only the correct episode should be selected and analysed, but also you won't have to remember to unclick the first episode of the season and accidentally blow a download credit.
Before:
After:
Brain Aneurysm Clipping Level (medium, skill and intricate work required)
Now that we can arbitrarily manipulate what 'Fab's cerebrum sees as episodes, why don't we go one further? Let's say we want to analyse and download a specific episode of a season? We can get a list of episodes that 'Fab sees, and get that episode's position in the list of episodes (again, a hack, not a fix, so you have to count manually (intricate work!) what that episode is, and not rely on episode numbering when Amazon listing doesn't match 1:1). Let's say we want to analyse episode 3 of season 3, and luckily, in this case that episode's position is actually 3. However, recall that python's arrays start at zero, not at one, so you have to subtract one from the position. So in the python-land, the index would be 2. Conveniently, we already have an array of the episodes constructed for us in the aforementioned function, so all we need to do is pluck out that specific episode from that array and return an array containing just that one episode. Simple to do in python, again working with line 174 only:
old like
now looks like
The advantage of this method over the "movie mode" is that this preserves all episode data, so you can queue up all episodes you like and then download them and all of them will be treated as series episodes by 'Fab.
Before:
After:
Haemorrhagic Stroke Repair Level (hard, you'd better get it right!)
Having read the previous hack, you might be tempted to say "you want me to sit there and count episodes to analyse a single episode, that's just daft?!" and you'll be partially right... We can do better, we can use the name of the episode! If you study the aforementioned function, there is a loop that iterated over the episodes data and constructs the episodes array, while the title of the episode under consideration in that loop is stored in a variable called "title". So what we can do is interfere with that loop so that only the episode with the requisite title gets added to the episodes array. You will notice that the actual adding of the episode to the final array is done on line 172, and that's where we want to clip. Again, as our luck has it, python provides a way to do a partial string match, and we can make our life even easier by doing a lower case match so we don't have to get the CaMeL casing of the title correctly. The way we clip the required episode is by saying only add episodes with lower case titles that match the string we give you. So, let's say we want the episode called "Glorious Five Year Plan" to be analysed, you would modify from
to
obviously the string you give in the if condition has to be sufficiently unique to single out the episode you're after, otherwise you're not going to get the correct result! And I've not tested this with anything other than latinised titles, so it might not work for other languages, which is why it's still a hack, and not a fix
Before:
After:
Naturally, you wouldn't want to be forced to remember and retype all those hacks as the case arises, so we can just keep that "collection" in the script, but commented out (by prepending a hash (#) in front of the code), and enable/disable things as the need arises, so my tail-end of that function changed from the original that looks like:
to a slightly messy one that looks like:
and as you can see, what I have enabled in my script at the moment is only reversing of the order of the episodes.
With all that, if your patient survives the brain surgery, well done, if you have the adverse outcome, well, you were warned!
So if you won't perform a craniotomy on yourself (read: not crazy and not desperate enough), quit reading this post and go back; for the adventurous kind, continues. All of the below assumes you have the "single season" mod, otherwise things get messy very fast and nor worth dealing with.
I had a particular problem where the pilot episode of a series was SD while the remainder of the series was perfectly good HD, and 'Fab was stuck analysing the pilot, even with the single season mod. It's pretty easy to infer, that whatever list of episodes is given to 'Fab's engine, the engine will take the first entry in the list and analyse that. Knowing that, we can perform some brain surgery on 'Fab to re-wire its brain. We will be operating on
Code:
amazon_get_seasons_info.py
Lobotomy Level (easy, anyone can do it)
The simplest way to get 'Fab to analyse something other than the first episode in a season, is to reverse the list of episodes and get 'Fab to analyse the last episode of the season (obviously this breaks if Amazon insert junk like specials etc in the main listing of the episodes instead of the specials, but that's why this is a hack (see terminology) and not a fix). You will observe that the aforementioned function returns a list of episodes on line 174 as
Code:
return episodes_array
Code:
return episodes_array[::-1]
Of course the additional benefit of this hack is that if you're only downloading the latest episode of a series and are careless like me, not only the correct episode should be selected and analysed, but also you won't have to remember to unclick the first episode of the season and accidentally blow a download credit.
Before:
After:
Brain Aneurysm Clipping Level (medium, skill and intricate work required)
Now that we can arbitrarily manipulate what 'Fab's cerebrum sees as episodes, why don't we go one further? Let's say we want to analyse and download a specific episode of a season? We can get a list of episodes that 'Fab sees, and get that episode's position in the list of episodes (again, a hack, not a fix, so you have to count manually (intricate work!) what that episode is, and not rely on episode numbering when Amazon listing doesn't match 1:1). Let's say we want to analyse episode 3 of season 3, and luckily, in this case that episode's position is actually 3. However, recall that python's arrays start at zero, not at one, so you have to subtract one from the position. So in the python-land, the index would be 2. Conveniently, we already have an array of the episodes constructed for us in the aforementioned function, so all we need to do is pluck out that specific episode from that array and return an array containing just that one episode. Simple to do in python, again working with line 174 only:
old like
Code:
return episodes_array
Code:
return [episodes_array[2]]
Before:
After:
Haemorrhagic Stroke Repair Level (hard, you'd better get it right!)
Having read the previous hack, you might be tempted to say "you want me to sit there and count episodes to analyse a single episode, that's just daft?!" and you'll be partially right... We can do better, we can use the name of the episode! If you study the aforementioned function, there is a loop that iterated over the episodes data and constructs the episodes array, while the title of the episode under consideration in that loop is stored in a variable called "title". So what we can do is interfere with that loop so that only the episode with the requisite title gets added to the episodes array. You will notice that the actual adding of the episode to the final array is done on line 172, and that's where we want to clip. Again, as our luck has it, python provides a way to do a partial string match, and we can make our life even easier by doing a lower case match so we don't have to get the CaMeL casing of the title correctly. The way we clip the required episode is by saying only add episodes with lower case titles that match the string we give you. So, let's say we want the episode called "Glorious Five Year Plan" to be analysed, you would modify from
Code:
episodes_array.append(e_obj)
to
Code:
if "five year plan" in title.lower(): episodes_array.append(e_obj)
obviously the string you give in the if condition has to be sufficiently unique to single out the episode you're after, otherwise you're not going to get the correct result! And I've not tested this with anything other than latinised titles, so it might not work for other languages, which is why it's still a hack, and not a fix
Before:
After:
Naturally, you wouldn't want to be forced to remember and retype all those hacks as the case arises, so we can just keep that "collection" in the script, but commented out (by prepending a hash (#) in front of the code), and enable/disable things as the need arises, so my tail-end of that function changed from the original that looks like:
Code:
count += 1 episodes_array.append(e_obj) return episodes_array
to a slightly messy one that looks like:
Code:
# +HACK+ pluck out by title #pluckout_title="five year plan" #if pluckout_title in title.lower(): episodes_array.append(e_obj) # +HACK+ default episode-set comprehension behaviour episodes_array.append(e_obj) # +HACK+ pluck out by index #pluckout_index=2 #return [episodes_array[pluckout_index]] # +HACK+ reverse order episodes return episodes_array[::-1] # +HACK+ default behaviour #return episodes_array
With all that, if your patient survives the brain surgery, well done, if you have the adverse outcome, well, you were warned!
Comment