Git Product home page Git Product logo

luarenamer's People

Contributors

mik1ll avatar thebluekinglp avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

luarenamer's Issues

Instructions for Linux

I managed to follow the install instructions for Linux and added the file to the .shoko/Shoko.CLI/plugins folder. But since I am on Linux, I could not follow the usage instructions entirely. Instead, I modified sample script.lua manually and saved it as my script.lua in the same folder. At this point I'm not sure anymore what my next step should be. Is sample script.lua the one that the renamer actually uses and should I not have created a new file? Or do I need to use a different name for it? Or add it to a configuration somewhere? I assume that Shoko Desktop does this for you, but I don't use that and it is not available on Linux. I'd appreciate some help with this.

In case you're curious about how I modified the sample script without Shoko Desktop. I basically removed all the logic and only kept the variables for the different parts that go into the filename. This allowed me to run it in an online runtime (JDoodle) so I could verify what the filename would be. This is the code that I used, maybe it'd be useful to add to the documentation somewhere (it could probably use better, more representative values for these variables).

local group = "[Fansub Group]"

local animename = "Isekai Anime"
animename = string.gsub(string.sub(animename, 0, 35), "%s+$", "") .. (#animename > 35 and "..." or "")

local episodename = "My First Day in Another World"
episodename = string.gsub(string.sub(episodename, 0, 35), "%s+$", "") .. (#episodename > 35 and "..." or "")

local episodenumber = "01"

local res = "1080p"
local codec = "AVC"
local bitdepth = "8bit"
local source = "HDD"

local fileinfo = "(" .. res .. " " .. codec .. " " .. bitdepth .. " " .. source .. ")"

local audiotag = "[AUDIOTAG]"
local subtag = "[SUBBED]"

local centag = "[UNCEN]"
local hashtag = "[deadbeef]"

local audios = "2.0"
local nametable = {group, animename, episodenumber, episodename, fileinfo, audiotag, subtag, centag, audios, hashtag}
filename = string.sub(table.concat(nametable, " "), 0, 120)

print(filename)

install on Docker

I have my ShokoServer on Docker (Manjaro Linux) and I use the Shoko Desktop app via Wine. I extracted the archive (linux version) to ~/.shoko/Shoko.CLI/plugin (inside ~/.shoko/Shoko.CLI/plugin/LuaRenamer is only lua subdirectory and files - no nested LuaRenamer directory). After restarting the server I opened Shoko Desktop, went to Utilities > File Renaming tab but there is no new renamer:
image

Hard to reproduce error on docker

Two users, Eclipse and kero_chan reported this error when renaming files.

17:50:20| SVR_VideoLocal_Place --- System.InvalidCastException: Unable to cast object of type 'NLua.LuaUserData' to type 'KeraLua.LuaFunction'.
   at NLua.Lua.GetFunction(String fullPath)
   at NLua.Lua.RegisterFunction(String path, Object target, MethodBase function)
   at LuaRenamer.LuaRenamer.CreateLuaEnv()
   at LuaRenamer.LuaRenamer.RunSandboxed(String code)
   at LuaRenamer.LuaRenamer.GetInfo()
   at LuaRenamer.LuaRenamer.GetFilename(RenameEventArgs args)
   at Shoko.Server.RenameFileHelper.GetFilename(SVR_VideoLocal_Place place, String scriptName) in /usr/src/app/source/Shoko.Server/Renamer/RenameFileHelper.cs:line 69
08:39:38| --- Trying to load /home/shoko/.shoko/Shoko.CLI/plugins/LuaRenamer/KeraLua.dll
Process terminated. A callback was made on a garbage collected delegate of type 'KeraLua!KeraLua.LuaFunction::Invoke'.
   at KeraLua.NativeMethods.lua_settable(IntPtr, Int32)
08:40:56| --- Trying to load /home/shoko/.shoko/Shoko.CLI/plugins/LuaRenamer/KeraLua.dll
            *Error: Unable to cast object of type 'NLua.LuaUserData' to type 'KeraLua.LuaFunction'.
            *Error: Unable to cast object of type 'NLua.LuaUserData' to type 'KeraLua.LuaFunction'.
            *Error: Unable to cast object of type 'NLua.LuaTable' to type 'KeraLua.LuaFunction'.
            *Error: Unable to cast object of type 'NLua.LuaUserData' to type 'KeraLua.LuaFunction'.
08:58:45| --- Trying to load /home/shoko/.shoko/Shoko.CLI/plugins/LuaRenamer/KeraLua.dll

Fix getname function

Source of error is from anime/episode getname lua function. (TitleFunction in LuaContext.cs)
Investigate possible changes in abstraction TitleType enum that causes this.

Error log from kero_chan#9048

13:22:26| SVR_VideoLocal_Place --- Error: The renamer returned an error on file: "/srv/Downloads/anime/[SubsPlease] Girls und Panzer das Finale - 03 (1080p) [EAD6892E].mkv"
            *Error: ...hoko/.shoko/Shoko.CLI/plugins/LuaRenamer/lua/lualinq.lua:434: attempt to compare number with nil
13:22:26| SVR_VideoLocal_Place --- Attempting to MOVE file: "/srv/Downloads/anime/[SubsPlease] Girls und Panzer das Finale - 03 (1080p) [EAD6892E].mkv"
13:22:27| SVR_VideoLocal_Place --- Could not find a valid destination: "/srv/Downloads/anime/[SubsPlease] Girls und Panzer das Finale - 03 (1080p) [EAD6892E].mkv"

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.