Skip to content

Instantly share code, notes, and snippets.

@pmartinez8241
Last active July 10, 2024 01:26
Show Gist options
  • Save pmartinez8241/fba787d22469b161732bbabb66e1a896 to your computer and use it in GitHub Desktop.
Save pmartinez8241/fba787d22469b161732bbabb66e1a896 to your computer and use it in GitHub Desktop.
local_tv_location <- "T:\\Media\\TV Shows"
network_tv_location <- r"{Z:\Entertainment\Media\TV Shows/}"
#************* ROOT COUNT ******************
root_local = list()
root_network = list()
root_local_dir = list.dirs(local_tv_location)
for(x in root_local_dir)
{
if(!grepl("Season", x, ignore.case = FALSE,fixed=TRUE)){
if(x!=local_tv_location){
root_local = append(root_local,x)
}
}
}
################################################################################
root_network_dir = list.dirs(network_tv_location)
for(x in root_network_dir)
{
if(!grepl("Season", x, ignore.case = FALSE,fixed=TRUE)){
if(x!=network_tv_location){
root_network = append(root_network,x)
}
}
}
print(c("LOCAL COUNT = ",length(root_local)))
print(c("NETWORK COUNT = ",length(root_network)))
#************* SEASON COUNT ******************
seasons_local = list()
seasons_network = list()
for(x in root_local_dir){
if(grepl("Season", x, ignore.case = FALSE,fixed=TRUE)){
seasons_local <- append(seasons_local,x)
}
}
################################################################################
for(x in root_network_dir){
if(grepl("Season", x, ignore.case = FALSE,fixed=TRUE)){
seasons_network <- append(seasons_network,x)
}
}
print(c("LOCAL SEASON COUNT = ",length(seasons_local)))
print(c("NETWORK SEASON COUNT = ",length(seasons_network)))
#************* EPISODE COUNT ******************
episodes_local = list()
episodes_network = list()
for(x in seasons_local){
for(y in list.files(x)){
episodes_local <- append(episodes_local,c(y))
}
}
for(x in seasons_network){
for(y in list.files(x)){
episodes_network <- append(episodes_network,c(y))
}
}
print(c("LOCAL EPISODE COUNT = ",length(episodes_local)))
epis_local = data.frame(matrix(unlist(episodes_local),nrow = length(episodes_local),byrow=TRUE))
colnames(epis_local) = c("Names")
write.table(file= r"{C:\Users\marti\Desktop\development\R\local_episode_count.txt}",x=epis_local,row.names = FALSE)
print(c("NETWORK EPISODE COUNT = ",length(episodes_network)))
epis_network = data.frame(matrix(unlist(episodes_network),nrow = length(episodes_network),byrow=TRUE))
colnames(epis_network) = c("Names")
write.table(file= r"{C:\Users\marti\Desktop\development\R\network_episode_count.txt}",x=epis_network,row.names = FALSE)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment