New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove old getIdFromFilename for let admin can implement it himself #286

Closed
hdsdi3g opened this Issue Jul 16, 2017 · 0 comments

Comments

@hdsdi3g
Owner

hdsdi3g commented Jul 16, 2017

And migrate it to a brand new JSModule.
Test with:
mydmam-cli.bash jsinjava -class "hd3gtv.mydmam.pathindexing.IdExtractorFileName" -module IdExtractorFileName -method isValidId -args "<file name>"
and
mydmam-cli.bash jsinjava -class "hd3gtv.mydmam.pathindexing.IdExtractorFileName" -module IdExtractorFileName -method getId -args "<file name>"

Example code:

        getId: function(filename) {
            if (filename == null) {
                return null;
            }
            if (filename.length < 8) {
                return null;
            }
            var curchar;
            for (var pos = 0; pos < 8; pos++) {
                curchar = filename.charCodeAt(pos);
                if ((curchar > 47) && (curchar < 58)) {
                    // * from 0 to 9
                    continue;
                }
                if (((curchar == 83) || (curchar == 115)) && (pos == 0)) {
                    // * Start by "S" or "s"
                    continue;
                }
                return null;
            }

            return filename.substring(0, 8);
        },

And

        isValidId: function(filename) {
            if (filename == null) {
                return null;
            }
            if (filename.length < 8) {
                return null;
            }

            var curchar;
            for (var pos = 0; pos < 8; pos++) {
                curchar = filename.charCodeAt(pos);
                if ((curchar > 47) && (curchar < 58)) {
                    // * from 0 to 9
                    continue;
                }
                if (((curchar == 83) || (curchar == 115)) && (pos == 0)) {
                    // * Start by "S" or "s"
                    continue;
                }
                return false;
            }
            return true;
        },

@hdsdi3g hdsdi3g added this to the v0 Beta version milestone Jul 16, 2017

@hdsdi3g hdsdi3g self-assigned this Jul 16, 2017

hdsdi3g added a commit that referenced this issue Jul 16, 2017

Update #286, correct #282 if boolean, rename module.* to universalmod…
…ule.*, and system ClassLoader don't works with play...

@hdsdi3g hdsdi3g moved this from Staged in dvl to Done, but needs to checks in Refactoring and consolidate alpha version Aug 1, 2017

@hdsdi3g hdsdi3g closed this Aug 1, 2017

@hdsdi3g hdsdi3g moved this from Done, but needs to checks to Ready to run in Refactoring and consolidate alpha version Aug 1, 2017

@hdsdi3g hdsdi3g moved this from Ready to run to Done in Master in Refactoring and consolidate alpha version Aug 1, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment