GithubHelp home page GithubHelp logo

GetInputSourcePath about avisynth_filter HOT 7 CLOSED

flossy83 avatar flossy83 commented on August 12, 2024
GetInputSourcePath

from avisynth_filter.

Comments (7)

CrendKing avatar CrendKing commented on August 12, 2024

https://github.com/CrendKing/avisynth_filter/actions/runs/3434003298

from avisynth_filter.

flossy83 avatar flossy83 commented on August 12, 2024

Thanks a lot, much appreciated.

eg.

AvsFilterSource()

if (FindStr(AvsFilterGetSourcePath(), "Series\Comedy\(2001-2003) The Office") != 0){
    Subtitle("Now playing: The Office")
}
else if (FindStr(AvsFilterGetSourcePath(), "Series\Comedy\(2005-2007) Extras") != 0){
    Subtitle("Now playing: Extras")
}
else {
    AvsFilterDisconnect()
}

#FindStr() is case-sensitive

from avisynth_filter.

Nuihc88 avatar Nuihc88 commented on August 12, 2024

This is a very minor detail, but i think it would be better to have a more consistent naming scheme, like either:
AvsFilterGetSourcePath() & VpsFilterGetSourcePath
or
AvsFilterSourcePath() & VpsFilterSourcePath
Otherwise people who use both AviSynth & VapourSynth are going to be getting it wrong half the time.

from avisynth_filter.

CrendKing avatar CrendKing commented on August 12, 2024

Reason is, AviSynth is a function, VapourSynth is a variable. It doesn't make sense to have a verb in a variable name.

The AvsFilterSource API is slightly different, that I'm following the existing convention in the avs world (e.g. AviSource, DirectShowSource). Otherwise, I'd name it AvsFilterGetSourceClip().

from avisynth_filter.

Nuihc88 avatar Nuihc88 commented on August 12, 2024

Reason is, AviSynth is a function, VapourSynth is a variable. It doesn't make sense to have a verb in a variable name.

Fair enough.

The AvsFilterSource API is slightly different, that I'm following the existing convention in the avs world (e.g. AviSource, DirectShowSource). Otherwise, I'd name it AvsFilterGetSourceClip().

Not quite sure i get what you mean by existing convention here, but many AviSynth-functions i know of, have names that lack the verb entirely. (e.g. ScriptFile() VersionString() Time("%#d/%#m/%y") )

So based on the ScriptFile() example, AvsFilterSourceFile() & VpsFilterSourceFile would also be consistent with AVS convention as i understand it.

from avisynth_filter.

CrendKing avatar CrendKing commented on August 12, 2024

Time("%#d/%#m/%y")

So without reading document, will user be able to tell if this sets time or gets time in specified format? Will user know VersionString() gets version or sets version with default value?

There is a good reason most coding style guides recommend having verb + subject form as function name for clarity. Like I said, the only reason AvsFilterSource was such named is because many avs functions do not have verb in their names. I have no idea why such convention was set, but I personally dislike it and consider wrong.

Since AvsFilterGetSourcePath is a new API and I believe very few people will use it, I think it's better to just do it the correct way.

from avisynth_filter.

Nuihc88 avatar Nuihc88 commented on August 12, 2024

So without reading document, will user be able to tell if this sets time or gets time in specified format? Will user know VersionString() gets version or sets version with default value?

I think in the context of AviSynth-scripting, the purpose of 'GetString'-type functions can be inferred, since most 'SetString'-type functions never need to be accessed from the scripting-interface, but i get why it would be bad for a project that needs to set time or spoof version info.

There is a good reason most coding style guides recommend having verb + subject form as function name for clarity. Like I said, the only reason AvsFilterSource was such named is because many avs functions do not have verb in their names. I have no idea why such convention was set, but I personally dislike it and consider wrong.

I suspect it was done in part for the sake of brevity and in part to create more of a separation between backend-code and user-side-scripting, but i get now what you mean.

Since AvsFilterGetSourcePath is a new API and I believe very few people will use it, I think it's better to just do it the correct way.

Ok, fair enough.

from avisynth_filter.

Related Issues (20)

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.