Giter Site home page Giter Site logo

Comments (7)

wader avatar wader commented on May 26, 2024 1

Ah sorry noticed your comment now. It's possible using _start, there are some reasons these are internal and i'm a bit reluctant to document and expose them more:

  • You can do _start etc on all decode value types (number, string, array) but it becomes ambiguous what "start" means for a struct (object), is it a field "start" or the start bit range?
  • Should start, stop etc be returned by keys? at the moment all _* fields are hidden from those functions as otherwise some parts of "standard" jq will act strange, ex you probably don't want ../recurse to see them.

So the current "safe" solution is that you have to use a function. But i'm open to change this if we can come up with something that don't mess too much with how one would expect jq to behave. Some new syntax could be interesting, ideally compatible with jq, but would require maintain larger change to gojq etc.

from fq.

wader avatar wader commented on May 26, 2024

Hi, i think you can already do it if i don't misunderstand what you want to do:

$ fq '.frames[1] | tobytes, tobytesrange, tobits, tobitsrange | {start,stop,size}' doc/file.mp3
{
  "size": 208,
  "start": 0,
  "stop": 208
}
{
  "size": 208,
  "start": 2937,
  "stop": 3145
}
{
  "size": 1664,
  "start": 0,
  "stop": 1664
}
{
  "size": 1664,
  "start": 23496,
  "stop": 25160
}

So binaries has start/stop/size properties but you have to use *range function or slice to get one that is "offsetted". Just tobytes will have a zero start value.

Hope that helps and let me know if it make sense :)

from fq.

wader avatar wader commented on May 26, 2024

Maybe the discussion in #639 is interesting also

from fq.

ksa-real avatar ksa-real commented on May 26, 2024

Yeah, I left a comment there recently. The question is why use an extra step? Why not just .frames[1].start?

from fq.

wader avatar wader commented on May 26, 2024

Close for now? maybe revisit in the future if some fancier syntax for "special" properties are introduces?

from fq.

ksa-real avatar ksa-real commented on May 26, 2024

Yes, closing. Underscore-prefixed items are great, somehow missed them. I guess they will stay unless something else is introduced.

from fq.

wader avatar wader commented on May 26, 2024

@ksa-real 👍 yeap think they will stay for now

from fq.

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.